RE: [SMARTY] Calling Object Methods (was Lack of Object Support)

From: Date: Thu, 02 Jan 2003 15:52:52 +0000
Subject: RE: [SMARTY] Calling Object Methods (was Lack of Object Support)
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-6990@lists.php.net to get a copy of this message
Whether I use {$object.method()} or {$object->method()} I get the same error: Fatal error: Smarty plugin error: [in news.tpl line 7]: unknown tag - '$story.getPreview()' in C:\Smarty\Smarty.class.php on line 2005 But if I set $story->preview = $this->getPreview() in the constructor and use {$story->preview} it works as expected. I'd prefer to use the method if it is supposed to work... I think I'm still missing something... Thanks Again - Geoff Hoffman PC> Don't use the ->, but use a . (dot), just as in: PC> {$object.method()} GH> Am I missing something here? GH> GH> GH> <http://smarty.php.net/manual/en/language.variables.objects.php> GH> says, in GH> part, GH> Properties of objects assigned from PHP can be referenced by specifying GH> the property name after the '->' symbol. GH> GH> What about object methods? Although perfectly logical, the following gives GH> an error: GH> GH> {$object->method()} GH>

« previous php.smarty.general (#6990) next »