support for array config variables
| From: | Bob Mroczka | Date: | Thu, 02 May 2002 15:59:25 +0000 |
| Subject: | support for array config variables | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-3994@lists.php.net to get a copy of this message | ||
I would like to access a config file section
as an array variable from a template like this:
my.conf:
[section]
About Us = about.php
FAQ = faq.php
mytemplate.tpl:
{config_load file="my.conf" section="section" assign="myarray"}
{foreach name=links from=$myarray key=text item=link}
{if $smarty.foreach.links.last}
<a href="{$link}" class="toprow">{$text}</a>
{else}
<a href="{$link}" class="toprow">{$text}</a> <font
size="2">|</font>
{/if}
{/foreach}
I was thinking of implementing this but was wondering if anyone
as a better idea on how to iterate over a config file section
from a template.
Thanks, Bob