Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Using objects in {insert} function

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
gerard
Smarty Regular


Joined: 18 Apr 2003
Posts: 84

PostPosted: Mon Oct 24, 2005 1:45 am    Post subject: Reply with quote

Can an object method be used for the name param? e.g.

Code:
{insert name=obj->header content="Content-Type: text/html"}
Back to top
View user's profile Send private message
gerard
Smarty Regular


Joined: 18 Apr 2003
Posts: 84

PostPosted: Mon Oct 24, 2005 5:19 pm    Post subject: Reply with quote

Not possible?
Back to top
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Mon Oct 24, 2005 5:23 pm    Post subject: Reply with quote

Sure -- if you specify an object method and if the object is available at the time of the insert (eg: during a cached call):

{insert name=$obj->header() content="Content-Type: text/html"}

Note the parens and the $.
Back to top
View user's profile Send private message
stot
Smarty Rookie


Joined: 13 Nov 2006
Posts: 17

PostPosted: Thu Feb 11, 2010 9:49 pm    Post subject: Reply with quote

is the $object->method() syntax still working for insert in the latest 2.6xxx smarty versions? Im getting an error:

Code:
Fatal error: Smarty error: [in nodeSideMenu.html line 34]: syntax error: 'insert: 'name' must be an insert function name (Smarty_Compiler.class.php, line 941) in C:\xampp\php\PEAR\Smarty\Smarty.class.php on line 1113


it sounds reasonable, since the documentation says, function named need to have "insert__" first.


Is there another way of non caching content?

Thanks,
stot
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General 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