Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
Dedicated server web hosting provided by Guru-host.eu.
Smarty with PHP 4

 
Post new topic   Reply to topic    Smarty Forum Index -> Add-ons
View previous topic :: View next topic  
Author Message
bkyzworld
Smarty n00b


Joined: 18 Oct 2005
Posts: 1

PostPosted: Tue Oct 18, 2005 4:30 am    Post subject: Smarty with PHP 4 Reply with quote

Hi, i just started to learn PHP 5.
i'm new to Smarty and PHP.
I was browsing this site/forums and learned a few things about the template engine and writing plugin functions.

anyway,
here is my situation.
my web hosting server is running php 4.
so, when I put up my 'project' and tried browsing my web site,
I got the 'unregonized tag' error from the template.
My function is named correctly,
function smarty_function_load_departments_list ($params, $smarty)
{ ...
}

and my template file call the plugin function as follows
{load_departments_list assign = "departments_list"}
...

I have the plugin file in the plugin directory.
I tried different file name, thinking that it might be too long for the server.
same problem. What troubles me is the fact that I think other plug in functions work. I have another plugin to load the department.

any pointer is greatly appreciated.
Back to top
View user's profile Send private message AIM Address
jeremywesselman
Smarty n00b


Joined: 14 Jan 2006
Posts: 1
Location: Independence, KY

PostPosted: Sat Jan 14, 2006 6:15 pm    Post subject: Reply with quote

Beginning PHP 5 and MySQL E-Commerce right?

I had the same problem. I was developing on PHP 5, which the book tells you to do. I was developing thier site, I was using the technology that I learned from thier book to develop an application for a client.

Anyway, PHP 4 and PHP 5 OOP standards are different. You have to make the adjustments to your plugin file to use the PHP 4 standards.

Here is a quick example of how I did it. You will have to take it on yourself to change your file.

[php:1:9cdb845523]<?php
// © Jeremy Wesselman @ JW Development - hollywoodwesselman@hotmail.com

class AdminHome
{
//public attributes
var $mTotalCategories;
var $mTotalSubCategories;
var $mTotalStores;

//private attributes
var $mCategories;

//constructor
function AdminHome()
{
$this->mCategories = new Categories();
}

function init()
{
$this->mTotalCategories = $this->mCategories->CountAllCategories();
$this->mTotalSubCategories = $this->mCategories->CountAllSubCategories();
$this->mTotalStores = $this->mCategories->CountAllStores();
}
}

/* smarty plugin function that gets called when the
load_merchant_home function plugin is loaded from a template */
function smarty_function_load_admin_home($params, &$smarty)
{
$admin_home = new AdminHome();
$admin_home->init();
// assign template variable
$smarty->assign($params['assign'], $admin_home);
}

?>[/php:1:9cdb845523]

This is how I changed my plugin files to deal with PHP 4. You shouldn't have to change anything in your template file, just the plugin file.

I hope that this solves your problem as it has solved mine.

Jeremy
Back to top
View user's profile Send private message Yahoo Messenger
johnyenglish007
Smarty n00b


Joined: 27 Jul 2006
Posts: 4

PostPosted: Sat Jul 29, 2006 11:05 pm    Post subject: question Reply with quote

Hi,

I have the same problem too... I've got the same error

PHP Fatal error: Smarty error: [in departments_list.tpl line 2]: syntax error: unrecognized tag 'load_departments_list' (Smarty_Compiler.class.php, line 580) in c:\program files\apache group\apache\htdocs\swa\libs\smarty\Smarty.class.php on line 1088

Can I ask you Jeremy, do you change anything in departments_list.tpl, do you still call '{load_departments_list assign="departments_list"} ' as syntax?

and in the plugin directory, is the file called 'function.load_departments_list.php' ?

It seems smarty can't recognize the tag function.load_departments_list.php..

Pls help and really appreciate your time on this
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Add-ons All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP