Re: [SMARTY-DEV] 2.4.2 and 2.3.0 incompatibilities

From: Date: Thu, 13 Feb 2003 15:31:20 +0000
Subject: Re: [SMARTY-DEV] 2.4.2 and 2.3.0 incompatibilities
References: 1  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-687@lists.php.net to get a copy of this message
Stricter syntax checking for function attributes has been committed to CVS, you should now get the appropriate error for: {foo bar=$page["foo"]["bar"]} Smarty: [in index.tpl line 4]: syntax error: invalid attribute value: '$page["foo"]["bar"]' Monte On Thu, 2003-02-13 at 06:09, Carsten Bleek wrote: > (second try, with correct sender) > > Hi, > > I´ve tried to upgrade to 2.4.2 but had to switch back > to 2.3.0 because of some incompatibilities. > > Also its documented not to use quotes I want to point this out. > > {include file=$page["template"]["content"]} > > produces the following PHP: > > $this->_smarty_include($this->_tpl_vars['page']."["template"]["content"]", > array()); > > which causes a parse error: > > Solution is to remove the quites like > {include file=$page[template][content]} > > > There seems to be annother problem with the scope of variables > in included templates. I´ve attached a small archiv containing > all needed files to reproduce the errro: > > The following 2 templates: > > 1. cat generic.tpl > ------------------ > Description=<b>{$page.description}<b><br> > {include file=$page[template][content]} > > 2. cat include.tpl > ------------------ > Content:= <b> {page.content} </b> > > accessed with the following PHP code: > ------------------------------------- > $page["template"]["content"]="include.tpl"; > $page["description"]="description"; > > $smarty=new Smarty_OpenHR; > $smarty->assign("page",$page); > $smarty->display('generic.tpl'); > > > is resulting into the folloing compiled PHP code > ------------------------------------------------- > <?php /* Smarty version 2.4.2, created on 2003-02-13 13:01:02 > compiled from generic.tpl */ ?> > Description=<b><?php echo > $this->_tpl_vars['page']['description']; ?> > <b><br> > <?php $_smarty_tpl_vars = $this->_tpl_vars; > > $this->_smarty_include($this->_tpl_vars['page'][$this->_sections['template']['index']][$this->_sections['content']['index']] > $this->_tpl_vars = $_smarty_tpl_vars; > unset($_smarty_tpl_vars); > ?> > > > which produces the following (browser) output: > ---------------------------------------------- > Description=description > > Warning: Smarty error: unable to read template resource: "" in > /home/carsten/public_html/jobs/lib/Smarty/Smarty.class.php on line 999 > ?> -- Monte Ohrt <monte@ispi.net>

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