Re: Stupid Regexp Bug?

From: Date: Thu, 31 Oct 2002 11:12:26 +0000
Subject: Re: Stupid Regexp Bug?
References: 1  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-310@lists.php.net to get a copy of this message
"Manuel Polo" <manuel.polo@sertelav.com> schrieb im Newsbeitrag news:3DC10CF4.8080109@sertelav.com... > Hi! > > I'm starting with smarty and realized that this simple line causes truble: > > <?xml version="1.0" encoding="{$pag_encoding"}"?> shouldn't this line looks like the following? <?xml version="1.0" encoding="{$pag_encoding}"?> I'm not sure if you get into troubles because of using "<?" which will be interpreted by apache as a php tag sometimes. > > I started with a more complex one : > > <?xml version="1.0" > encoding="{$pag_encoding|default:"ISO-8859-1"}"?> > > Also I looked at the code (in Smarty_Compiler.class.php) and saw that is > used \w for variable names (am I Wrong?) , i'd like to allow pseudo > object variable names like: page.encoding instead of page_encoding.. :) You can work either with real with real objects or associative arrays. <?php $pageSettings = Array("encoding"=>"UTF-8","xyz"=>"myValue"); // alternatively you can use objects // $pageSettingsObject = new myObject(); $template = new smarty(); $template->assign("pag", $pageSettings); // using associative arrays // in case you want to use objects: // $template->assign("pag", $pageSettingsObject); $template->display("myTemplate"); ?> Now your template should look like this: <?xml version="1.0" encoding="{$pag.encoding|default:"ISO-8859-1"}"?> or <?xml version="1.0" encoding="{$pag[encoding]|default:"ISO-8859-1"}"?> (both should work i think) Or I you have assigned an object instead of an associative array try this: <?xml version="1.0" encoding="{$pag->encoding|default:"ISO-8859-1"}"?> hope this help, André > > Thanks! > > -- > > Manuel Polo Tolón > > Dpto. I+D > Servicios de Telefonía Avanzada > Juan De la Cierva #23 > 50014 Zaragoza > Tlf. +034 902 11 12 21 > ___________________________________________________________________________ _ _ > / La información incluida en el presente correo electrónico es CONFIDENCIAL, > | siendo para el uso exclusivo del destinatario arriba mencionado. Si usted > | lee este mensaje y no es el destinatario señalado, el empleado o el agente > | responsable de entregar el mensaje al destinatario, o ha recibido esta > | comunicación por error, le informamos que está totalmente prohibida > | cualquier divulgación, distribución o reproducción de esta comunicación, y > | le rogamos que nos lo notifique, nos devuelva el mensaje original a la > | dirección arriba mencionada y borre el mensaje. > | Gracias. > \___________________________________________________________________________ _ _ > >

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