RE: Calling object methods from smarty variables
| From: | Steve | Date: | Wed, 27 Feb 2002 22:17:49 +0000 |
| Subject: | RE: Calling object methods from smarty variables | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-2884@lists.php.net to get a copy of this message | ||
I solve this problem by having an allErrorMessages array that is filled in
my php script with error objects - and the message is an attribute of the
object.
As a matter of fact 99% of the data I pass my templates is arrays of objects
that are used mostly as data containers (meaning I don't follow the OO
concepts to purity because I don't use accessors and setters). Makes the
template code VERY easy to read, and the php code is very easy to maintain.
-----Original Message-----
From: David Heinemeier Hansson [mailto:david@loudthinking.com]
Sent: Wednesday, February 27, 2002 8:36 AM
To: smarty@lists.ispi.net
Subject: [smarty] Calling object methods from smarty variables
It doesn't seem to be possible to call {$person->getFullName()}. Is
there a work-around to this? The piece below works just fine (the method
returns an array of error messages), so I found it strange that the
simpler version didn't work.
{foreach from=$errors->getAllErrorMessages() item=errorMessage}
<li>{$errorMessage}</li>
{/foreach}
I read through the archives and saw a reference [1] to some work-around
in the CVS repository, but I haven't been able to find this repository.
Does anyone has the work-around or can tell me how to access the
repository?
[1] http://marc.theaimsgroup.com/?l=smarty&m=101171218430078&w=2
--
David Heinemeier Hansson <david@loudthinking.com>
http://www.LoudThinking.com/ -- Broadcasting Brain
---
You are currently subscribed to smarty as: lists@iwsys.com
To unsubscribe send a blank email to $subst('Email.Unsub')
Visit Smarty's homepage at http://www.phpinsider.com/php/code/Smarty/