tags:

views:

27

answers:

1

Im trying to view contents of array on the page:

    {foreach from=$entries key=i item=topic}
        {if $topic.topic_style == question}
            <li class="mail">
                <a href="topic.php?id={$topic.id}">{$topic.title} </a>
                    {$topic.tags}
            </li>
        {/if}
    {/foreach}

$topic.tags is an array but i dont seem to be able to extract the contents to the page can anyone help?

A: 

Try this:

{foreach from=$entries key=i item=topic}
    {if $topic.topic_style == question}
        <li class="mail">
            <a href="topic.php?id={$topic.id}">{$topic.title} </a>
                {foreach from=$topic.tags key=j item=tag}
                    {$tag}
                {/foreach}
        </li>
    {/if}
{/foreach}

Where tag is the value of the tag name in the tags array().

Treffynnon
Great that works, any idea about the following issue I still have: http://stackoverflow.com/questions/3415970/smarty-templates-return-product-info-based-on-topic-type
danit
I have commented on the first answer in your other problem. Perhaps you could mark my answer here as the accepted one?
Treffynnon