Re: [SMARTY] alternating background colors
| From: | Blue Presley | Date: | Sat, 24 Aug 2002 21:13:46 +0000 |
| Subject: | Re: [SMARTY] alternating background colors | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-5823@lists.php.net to get a copy of this message | ||
Thanks for the help. here is the section from my code
{section name=searchresults loop=$ids}
<tr>
<td width="25%" height="30">{$ids[searchresults].postdate}</td>
<td width="25%" ><a href="jobdetails.php?ID={$ids[searchresults].adid}">{$ids[searchresults].adtitle}</a></td>
<td width="25%" >{$ids[searchresults].location}</td>
<td width="25%" >{$ids[searchresults].companyname}</td>
</tr>
{/section}
the above works perfectly and will return the appropriate results from my database query. Here is the code with CYCLE incorporated as suggested.
{section name=searchresults loop=$ids}
<tr bgcolor="{cycle values="#d0d0d0,#eeeeee"}">
<td width="25%" height="30">{$ids[searchresults].postdate}</td>
<td width="25%" ><a href="jobdetails.php?ID={$ids[searchresults].adid}">{$ids[searchresults].adtitle}</a></td>
<td width="25%" >{$ids[searchresults].location}</td>
<td width="25%" >{$ids[searchresults].companyname}</td>
</tr>
{/section}
the above code will not allow the section to display the appropriate values.. it's just blank. Any thoughts why this would be happening? I also do not have access to the server on which smarty is installed and the version is a little older. Is CYCLE a new addition? Could that be the problem?
thanks again
blue
At 07:09 PM 8/24/2002 +1200, Greg Elisara wrote:
I am unsuccessful at getting cycle to work within my script. It keeps
preventing {section} from operating correctly. Could someone please
provide a working example or a link that demonstrates its use?
hi blue, the following is from a page i use:
<table>
{section name=i loop=$QueryResult}
<tr bgcolor="{cycle values="#d0d0d0,#eeeeee"}">
<td valign="top"><p>{ $QueryResult[i].name }</p></td>
</tr>
{/section}
</table>
regards. greg.