Re: [SMARTY] Cycle and Config Variables

From: Date: Mon, 17 Jun 2002 13:41:17 +0000
Subject: Re: [SMARTY] Cycle and Config Variables
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-4903@lists.php.net to get a copy of this message
One way would be to combine your colors in the config file. If you use them separately, then supply them both ways: bgColor1 = #ffffff bgColor2 = #eeeeee bgColorCycle = #ffffff,#eeeeee {cycle values=#bgColorCycle#} dgcspm@hotmail.com wrote:
I am having a problem with setting multiple values for {cycle} using config variables. I would like to do this: {cycle values="#bgColor1#,#bgColor2#"} But that simply outputs literal "#bgColor1#" and "#bgColor2#" instead of their values. Not very colorful. So then I tried {cycle values=#bgColor1#,#bgColor2#} But that results in this error. Fatal error: Smarty: [in test.tpl line 16]: syntax error: invalid attribute name - '#bgColor2#' After playing around I discovered I could do this: {assign var="bgColor1" value=#bgColor1#} {assign var="bgColor2" value=#bgColor2#} or {eval var=#bgColor1# assign="bgColor1"} {eval var=#bgColor2# assign="bgColor2"} then {cycle values="$bgColor1,$bgColor2"} But that's two more lines of code than I want to use. I'm a newbie to Smarty so I'm probably missing something. Is there a way to eval the config variables as part of a cycle value without resorting to these extra lines? Thanks!
-- Monte Ohrt <monte@ispi.net> Director of Technology, ispi Inc.

« previous php.smarty.general (#4903) next »