RE: Chained method calls
"Dave Mittner" <[email protected]> Thu, 3 Jan 2008 11:11:04 -0700
| Newsgroups | gmane.comp.php.smarty.devel |
|---|---|
| Message-ID | <01be01c84e34$02881dc0$07985940$@com> |
I'm +1 for it, as well. I've tended to walk the line between what others perceive as acceptable template usage and I've passed quite a few objects into templates to be accessible should the template need the data there-in. A good example is a user object. But what if the user object has a company object? $user->getCompany()->getCompanyName(). I don't think that'd be breaking too many accepted conventions. And to compare to other templating engines, I believe Velocity supports such syntax. I personally see this opening more doors than it would cause problems, myself. It's adding optional support that, in its absence, might require people to assign temporary Smarty variables- an ugly process in and of itself. Rikaelus -----Original Message----- From: messju mohr [mailto:[email protected]] Sent: Thursday, January 03, 2008 3:40 AM To: [email protected] Subject: Re: [SMARTY-DEV] Chained method calls I'm +1 for adding this, too. I know the reason this was not added to Smarty is, that this does not work under php4. Smarty would generate broken php code under php4 when doing {$foo->bar()->baz()}. I don't think that the possible impact on php4 is such a big deal. Some template code that did not compile before (Smarty syntax error) does now throw a php syntax error. But the benefits for php5 are there - and counting the number of requests for this feature the demand seems high. greetings messju On Sun, Dec 09, 2007 at 01:27:50PM -0200, Diego Feitosa wrote: > Hi all, > > Today, working with Smarty, I realized that a simple feature (chained > method calls) was not present... Hopefully, after 2 minutes searching at > google, I found this patch: > http://codepoets.co.uk/smarty_chained_function_calls > > Is there any possibility to include this patch into the engine?? > I think this will be very usefull :) > > I don't know how much impact this can bring to the entire distribution, > but at least here, there's no negative impact. > > Thanks!! > -- > Diego Feitosa > www.dnfeitosa.com <http://www.dnfeitosa.com> -- Smarty Development Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Smarty Development Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php