Re: [SMARTY-DEV] RE: parser syntax change

From: Date: Thu, 19 Dec 2002 14:27:08 +0000
Subject: Re: [SMARTY-DEV] RE: parser syntax change
References: 1 2 3  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-457@lists.php.net to get a copy of this message
I know the current CVS version has some problems. I have a *bunch* of updates that I have done since two days ago that I have not committed yet. I'm still smoke testing it, but expect them to be committed later today. I'll make sure your examples here work too. Monte On Thu, 2002-12-19 at 02:40, André Rabold wrote: > Hi folks, > > I found some bugs in the latest CVS version: > > - {$sectionvar[record.index_prev]} doesn't work anymore > - {$foo.$bar} doesn't work anymore > - {$foo->bar->blah()} doesn't work (cascaded objects wouldn't be too bad) > ;-) > > > So I checked the Smarty_Compiler and *tatatataaaaa* here are some > fixes! But here is a small question: Is {$foo[bar.blah.blub]} possible and > does this make sense? Because of the {$sectionvar[record.index_prev]} fix > I implemented this works now too - good or bad? > Cascading objects {$foo->bar->blah->blub()} should be possible or not? I > use it because I have a single global object containing all others (i.e. > $nextgen->user, $nextgen->module, $nextgen->settings etc.). So there are > no naming conflicts with regular template variables. Thoughts? > > André > > > > cvs diff Smarty_Compiler.class.php (in directory C:\CVS-Checkout\smarty\) > Index: Smarty_Compiler.class.php > =================================================================== > RCS file: /repository/smarty/Smarty_Compiler.class.php,v > retrieving revision 1.136 > diff -r1.136 Smarty_Compiler.class.php > 99a100 > > // $foo.$bar > 104a106 > > // $foo[5].$bar > 106c108 > < $this->_dvar_regexp = '\$\w+(?:\[\$?\w+\])*(?:\.\w+(?:\[\$?\w+\])*)*'; > --- > > $this->_dvar_regexp = > '\$\w+(?:\[\$?\w+(?:\.\w+)*\])*(?:\.\$?\w+(?:\[\$?\w+(?:\.\w+)*\])*)*'; > 145c147,148 > < $this->_obj_regexp = '(?:\$\w+(?:\.\w+)*\->\w+(?:\((?:(?:\w+|' . > $this->_var_regexp . $this->_mod_regexp > --- > > // $foo->bar->blah() > > $this->_obj_regexp = > '(?:\$\w+(?:\[\$?\w+(?:\.\w+)*\])*(?:\.\w+)*(?:\->\w+(?:\[\$?\w+(?:\.\w+)*\] > )*(?:\.\w+)*)*\->\w+(?:\((?:(?:\w+|' . $this->_var_regexp . > $this->_mod_regexp > 1260c1263 > < > preg_match_all('!(^\w+)|(?:\[\$?\w+\])|\.\w+|->\w+(?:\([^\)]*\))?!', > $var_ref, $match); > --- > > > preg_match_all('!(^\w+)|(?:\[\$?\w+(?:\.\w+)*\])|\.\$?\w+|->\w+(?:\([^\)]*\) > )?!', $var_ref, $match); > > > > > > "Monte Ohrt" <monte@ispi.net> schrieb im Newsbeitrag > news:1040257085.11946.201.camel@lena.ispi.prv... > > No... currently the assigned template variables are extracted into PHP > > name space upon a fetch() or display(). This was done basically so the > > embedded variables in function params would work: > > > > {myfunc file="$foo/$bar.tpl"} > > > > Now we handle this differently, and no extraction is required. The > > variables are assigned to the template in thier own namespace, and they > > are referenced as such. > > > > Monte > > > > On Wed, 2002-12-18 at 16:58, Gerard wrote: > > > > Since the removal of exporting assigned variables. > > > > > > What exactly was that? PHP globals or something? > > > > > > Gerard > > -- > > Monte Ohrt <monte@ispi.net> > > -- Monte Ohrt <monte@ispi.net>

« previous php.smarty.dev (#457) next »