Re: SIGMA and preserve_data

From: Date: Sat, 12 Mar 2005 15:03:07 +0000
Subject: Re: SIGMA and preserve_data
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-17994@lists.php.net to get a copy of this message
Hi, Mario Gzuk wrote:
Are you doing the setOption() call before or after setVariable()? It will have no effect after setVariable().
---SNIP---- $template =& new HTML_Template_Sigma('.'); $template->loadTemplateFile('modules/software/templates/new_software.html'); $template->setOption('preserve_data',true); $template->setCallbackFunction('lang', 'sigma_setlang'); $template->setCallbackFunction('link', 'sigma_createlink'); $software=db_selectID('unattended_software',$id); if ($software!=false) { $template->setVariable(array('id'=>$software['id'], 'software'=>$software['software'], 'regkey'=>$software['regkey') } ---SNAP--- if now the regkey has the value \\HKLM\...\{092714hlnsdsaw29724} the last part {092714hlnsdsaw29724} will not be shown.
The following minimal code <?php require_once 'HTML/Template/Sigma.php'; $tpl =& new HTML_Template_Sigma(); $tpl->setTemplate('This is the key: {regkey}'); $tpl->setOption('preserve_data', true); $tpl->setVariable('regkey', '\\\\HKLM\\...\\{092714hlnsdsaw29724}'); $tpl->show(); ?> works as expected, displaying This is the key: \\HKLM\...\{092714hlnsdsaw29724} Your example is not self-contained, therefore I suspect that there are some errors in the parts of the code you decided not to show.

« previous php.pear.general (#17994) next »