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

Access methods of a class

 
Post new topic   Reply to topic    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
alxgorlov
Smarty n00b


Joined: 25 Jun 2007
Posts: 1

PostPosted: Mon Jun 25, 2007 10:28 am    Post subject: Access methods of a class Reply with quote

From FAQ:
Quote:
Q: How can I access methods of a class that was returned by an assigned object? For example: {$obj->getMemberObj()->foo()} . I tried to {assign} $obj->getMemberObj() first but that didn't work either.

A: You can't, at least not in PHP4. This is a limitation of the language. In PHP5 this has been solved. Instead, assign the variable first, and then call the function.

{assign var='object' value=$obj->getMemberObj()}

Foo is now: {$object->foo()}

Top


I use PHP5. If it's posible how to access methods of a class directly?
Back to top
View user's profile Send private message
boots
Administrator


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

PostPosted: Mon Jun 25, 2007 4:59 pm    Post subject: Reply with quote

Sorry, method derefrencing is not supported.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    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