Re: Sigma template

From: Date: Fri, 09 Jul 2004 14:19:18 +0000
Subject: Re: Sigma template
References: 1 2 3 4 5 6  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-13575@lists.php.net to get a copy of this message
Hi Alexey, The code I was using is as follow: --- (PHP) --- function cycle($a1, $a2) { global $i; $i++; return ($i % 2) ? $a1 : $a2; } $parser =& new HTML_Template_Sigma(TPL_PATH, TPL_CACHE_PATH); $parser->loadTemplateFile("contact_confirmation.tpl"); $parser->setCallbackFunction("cycle", "cycle"); $parser->setVariable($contact); $index_content .= $parser->get(); And my template looks like this: --- (TPL) --- ... <tr align="left" valign="top" class="email-td" style="background-color: func_cycle('#eeeeee', '#ccccff')"> <td width="30%"><b>Your IP Address:</b></td> <td>{ip_address}</td> </tr> <tr align="left" valign="top" class="email-td" style="background-color: func_cycle('#eeeeee', '#ccccff')"> <td width="30%"><b>Your Full Name: </b></td> <td>{full_name}</td> </tr> <tr align="left" valign="top" class="email-td" style="background-color: func_cycle('#eeeeee', '#ccccff')"> <td width="30%"><b>Your Email Address: </b></td> <td>{email}</td> </tr> ... And as mentioned in my previous email, I've also added 'echo "test";' to the function cycle() and I see the string "test" only once so the function was called only once... With any other function, I would be very pleased with this behaviour, but some functions returns different values so it would be nice to tell Sigma to expect this for those functions, that's all. Is there a way to do this beside a func_cycle('#eeeeee', '#ccccff', 1), func_cycle('#eeeeee', '#ccccff', 2), func_cycle('#eeeeee', '#ccccff', 3), etc...? Thanks, Xavier On Fri, 2004-07-09 at 10:06, Alexey Borzov wrote: > Hi, > > Xavier Spriet wrote: > > Thanks for responding. > > > > For the documentation part, simply cutting and pasting the toggle() > > function from the documentation on the latest release of Sigma along > > with the PHP calls (setCallBackFunction() especially) always returns the > > same value for func_bgcolor('#CCCCCC', '#F0F0F0') so all the columns > > are > > the same colour. > > Can you post the exact code *you* are using and describe exactly what > you are trying to achieve? Thanks, Xavier Spriet.

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