Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
Method chaining

 
Post new topic   Reply to topic    Smarty Forum Index -> Smarty Development
View previous topic :: View next topic  
Author Message
ryanmc
Smarty Rookie


Joined: 22 Feb 2013
Posts: 20

PostPosted: Fri Mar 01, 2013 11:27 pm    Post subject: Method chaining Reply with quote

Hey guys I know this topic has been discussed before

http://www.smarty.net/forums/viewtopic.php?p=52907
http://www.smarty.net/forums/viewtopic.php?p=47161
http://www.smarty.net/forums/viewtopic.php?t=10392
http://www.smarty.net/forums/viewtopic.php?t=3862

From this topic (http://www.smarty.net/forums/viewtopic.php?p=47161) it sounds like it was implemented, and from this topic (http://www.smarty.net/forums/viewtopic.php?p=52907) it sounds like it was put in v2.6.18. However I dont see any documentation (I could be blind), and when I try and use examples from the above posts I am getting an error. I am using Smarty 2.6.26 and PHP 5.3.14

Here is the PHP code to assign the object
Code:
$objSmarty->assign_by_ref( 'search_filter', $this->m_objSearchFilter );


Here is the tpl code
Code:
{$SearchFilter->getPicker('CPropertyPicker')->buildPicker()}


Here is the error
Code:
syntax error: unrecognized tag: $SearchFilter->getPicker('CPropertyPicker')->buildPicker()


Am I misunderstanding the above posts or am I doing something wrong?

Thanks in advance for your help.
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 4508
Location: Hamburg / Germany

PostPosted: Sat Mar 02, 2013 2:55 pm    Post subject: Reply with quote

Smarty2 does not support object chaining. Smarty3 does

Workaround

Code:

{assign name='foo' value=$SearchFilter->getPicker('CPropertyPicker')}
{$foo->buildPicker()}
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Smarty Development 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