Cycle and Config Variables

From: Date: Mon, 17 Jun 2002 07:59:27 +0000
Subject: Cycle and Config Variables
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-4890@lists.php.net to get a copy of this message
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!

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