Re: [SMARTY] Class::method() in if tags

From: Date: Mon, 08 Mar 2004 17:22:53 +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-11076@lists.php.net to get a copy of this message
The regexes are broken down into digestible chunks in the compiler class. If you view them after they are assembled they are quite long. These regexes are only run at compile time, so performance is really a non-issue. As for dereferencing, Smarty does not officially support PHP5 yet. The support for this syntax should be pretty straight forward. Try the following (untested): In Smarty_Compiler.class.php, replace these two lines: $this->_obj_start_regexp = '(?:' . $this->_dvar_regexp . '(?:' . $this->_obj_ext_regexp . ')+)'; $this->_obj_call_regexp = '(?:' . $this->_obj_start_regexp . '(?:' . $this->_obj_params_regexp . ')?)'; with this: $this->_obj_call_regexp = '(?:' . $this->_dvar_regexp . '(?:(?:' . $this->_obj_ext_regexp . ')+' . '(?:' . $this->_obj_params_regexp . ')?)*)'; On Mon, 2004-03-08 at 09:22, Jochem Maas wrote: > David Förster wrote: > > > Hello, > > > > {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? > > Hi, > > I posted a related question about that I would like to use dereferenced > syntax (PHP5) e.g. > > {$Field->getValue()->getName()} > > does anyone have any pointers (maybe tips onchanging the rather long > regexps that are used to parse the templates*), maybe one of the smarty > developers has some insight regarding possible future support of the > dereferenced/static object syntax? > > *I haven't had much success in trying to change the 1000+ char regexp > that is used to indentify/parse PHP 'object'-related expressions. > > rgds, > > Jochem > > ps - sorry for reposting but I am really in need of a pointer or to know > whether there is any intention to support the above mentioned. I had the > idea that maybe my last post was not well understood (or it just > silently fell off the radar, so to speak... these things happen ;-) > > pps - just out of interest, do the regexps used to parse the templates > really need to be so long? my first impression was 'its got to be > possible to do that more consisely' - I atleast assumed that Smarty has > a potential performance gain to be had by optimizing these regexps. I > was quite amazed by the size!

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