Re: [SMARTY] Class::method() in if tags
| From: | messju mohr | Date: | Mon, 08 Mar 2004 22:29:59 +0000 |
| Subject: | Re: [SMARTY] Class::method() in if tags | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-11079@lists.php.net to get a copy of this message | ||
On Mon, Mar 08, 2004 at 01:48:01PM -0800, boots wrote:
> --- messju mohr <messju@lammfellpuschen.de> wrote:
> > On Mon, Mar 08, 2004 at 04:22:34PM +0100, Jochem Maas wrote:
> > > David F?rster wrote:
> > > >{if Auth::logged_in()}
> > > >produces
> > > >Fatal error: Smarty: [in main.tpl line 115]: syntax error:
> > unidentified
> > > >token '::logged_in()'
> > > >
> > > >Can I use a different syntax or are there any plans to support
> > that in the
> > > >future?
> >
> > this would enable static method-calls inside if-functions:
> >
>
> [snip]
>
> > is that of broader use?
>
> Do we want to do this?
I don't want to "do this".
> Are template designers concerned between the differences between
> class methods and object methods? If Auth is used as a registered
> object (class would also work) this problem goes away and no new
> syntax is introduced.
If we want to project this to the dump-designer-theory: I don't think
"the designer" would have more or less problems with Auth::logged_in()
than with Auth__logged_in(). He/she just needs proper documentations
and/or instructions.
"The designer" would only have problems with ($)auth->logged_in() because
his/her wysiwig-editor doesnt't like the ">" after "-". but that's
another story...
> As for derefrenced objects, the same notion applies: is there a need to
> reference arbitrary positions in an object hierarchy?
There are situations where this is useful. I know "The designers" that
have no problems accessing structures like the ones SimpleXML provides,
that's just a mapping of dom->arbitrary_positions_in_an_object-
hierarchy . And sometimes it's an unnecessary kind of redundance to
put a layer in-between that. Just *sometimes*, sometimes such a layer
is beneficial, of course.
> Is this something that designers should be concerned about
> (ie. should designers have to know the application object model or
> should they be given 'simple' template tools/structure?)
> Personally I pass a single "payload" to my main template and then
> dynamically included templates which are passed the appropriate
> portions of the total payload. That way, each template is at the
> "right" scope.
Personally I pass something abstract and teach the template-writers a
small set of of modifiers to access children/attributes/siblings of
the page's data. That works out well. {$foo|@children} and
{$foo->children()} are just a matter of how you look on them.
But I alreay said: "I don't want to do this." I have no need on static
method calls at all.