cvs: smarty / NEWS /docs designers.sgml /libs Smarty_Compiler.class.php

From: Date: Fri, 04 Apr 2003 23:19:02 +0000
Subject: cvs: smarty / NEWS /docs designers.sgml /libs Smarty_Compiler.class.php
Groups: php.smarty.cvs 
Request: Send a blank email to php-smarty-cvs+get-511@lists.php.net to get a copy of this message
mohrt Fri Apr 4 18:19:02 2003 EDT Modified files: /smarty NEWS /smarty/docs designers.sgml /smarty/libs Smarty_Compiler.class.php Log: change backtic syntax from $foo to $foo Index: smarty/NEWS diff -u smarty/NEWS:1.332 smarty/NEWS:1.333 --- smarty/NEWS:1.332 Fri Apr 4 15:15:47 2003 +++ smarty/NEWS Fri Apr 4 18:19:02 2003 @@ -1,3 +1,4 @@ + - change backtic syntax from $foo to $foo (Monte) - recognize $foo[][] syntax inside embedded quotes without backtics (Monte) - name=123 is passed as an integer (not a string) to plugins now (messju) Index: smarty/docs/designers.sgml diff -u smarty/docs/designers.sgml:1.59 smarty/docs/designers.sgml:1.60 --- smarty/docs/designers.sgml:1.59 Wed Mar 19 06:46:07 2003 +++ smarty/docs/designers.sgml Fri Apr 4 18:19:02 2003 @@ -110,6 +110,30 @@ &lt;/SELECT&gt;</programlisting> </example> </sect1> + <sect1 id="language.syntax.quotes"> + <title>Embedding Vars in Double Quotes</title> + <para> + Smarty will recognize assigned variables embedded in double quotes so long + as the variables contain only numbers, letters, underscores and brackets + []. With any other characters (period, object reference, etc.) the variable + must be surrounded by backticks. + </para> + <example> + <title>embedded quotes syntax</title> + <programlisting> +SYNTAX EXAMPLES: +{func var="test $foo test"} &lt-- sees $foo +{func var="test $foo_bar test"} &lt-- sees $foo_bar +{func var="test $foo[0] test"} &lt-- sees $foo[0] +{func var="test $foo[bar] test"} &lt-- sees $foo[bar] +{func var="test $foo.bar test"} &lt-- sees $foo (not $foo.bar) +{func var="test $foo.bar test"} &lt-- sees $foo.bar + +PRACTICAL EXAMPLES: +{include file="subdir/$tpl_name.tpl"} &lt-- will replace $tpl_name with value +{cycle values="one,two,$smarty.config.myval"} &lt-- must have backticks</programlisting> +</example> + </sect1> </chapter> Index: smarty/libs/Smarty_Compiler.class.php diff -u smarty/libs/Smarty_Compiler.class.php:1.202 smarty/libs/Smarty_Compiler.class.php:1.203 --- smarty/libs/Smarty_Compiler.class.php:1.202 Fri Apr 4 15:15:48 2003 +++ smarty/libs/Smarty_Compiler.class.php Fri Apr 4 18:19:02 2003 @@ -38,7 +38,7 @@ * @package Smarty */ -/* $Id: Smarty_Compiler.class.php,v 1.202 2003/04/04 20:15:48 mohrt Exp $ */ +/* $Id: Smarty_Compiler.class.php,v 1.203 2003/04/04 23:19:02 mohrt Exp $ */ class Smarty_Compiler extends Smarty { @@ -1452,7 +1452,7 @@ function _expand_quoted_text($var_expr) { // if contains unescaped $, expand it - if(preg_match_all('%(?<!\\\\)\$(?:\' . $this->_dvar_guts_regexp . '\|\w+(\[[a-zA-Z0-9]+\])*)%', $var_expr, $_match)) { + if(preg_match_all('%(?:\(?<!\\\\)\$' . $this->_dvar_guts_regexp . '\)|(?:(?<!\\\\)\$\w+(\[[a-zA-Z0-9]+\])*)%', $var_expr, $_match)) { $_match = $_match[0]; rsort($_match); reset($_match);

« previous php.smarty.cvs (#511) next »