Template Variable Question
| From: | Steve | Date: | Mon, 04 Mar 2002 17:42:28 +0000 |
| Subject: | Template Variable Question | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-2947@lists.php.net to get a copy of this message | ||
I'm trying to figure out how to use a variable in a template. I have the
following code block to illustrate what I'd like to do:
{if $productList[p]->hidden eq 1}
<tr bgcolor="#{#hiddenColor#}">
{$fontColor = "888888"}
{$linkClass = "greylink"}
{elseif $smarty.section.p.rownum mod 2 eq 1}
<tr bgcolor="#{#altRowColor#}">
{$fontColor = "000000"}
{$linkClass = "blacklink"}
{else}
<tr bgcolor="#ffffff">
{$fontColor = "000000"}
{$linkClass = "blacklink"}
{/if}
And then use the $fontColor and $linkClass in each <td> for this row of a
table. What is the correct syntax to assign a variable in a template and
then later echo that variable? I tried $smarty.fontColor = "000000" and
that didn't work either.
Thank You,
Steve