Page 1 of 1

[SOLVED] How to extract category names from news list?

Posted: Thu Jul 12, 2007 4:42 pm
by Michael AC
Hi all,

I'm trying to style my news summary template.

Code: Select all


<!-- Start News Display Template -->

{foreach from=$items item=entry}
<div class="NewsSummary">

<div class="NewsSummary{cycle values="_odd,_even"}">
	{$entry->titlelink}<br />

{if $entry->summary}
	{eval var=$entry->summary}

{else if $entry->content}

	{eval var=$entry->content}
{/if}

</div>
</div>
{/foreach}

<!-- End News Display Template -->
That's the downsized pure standard news summary template just showing title and summary (with "_odd" and "_even" addons for styling an alternating background per entry)

This news summary page is shown after the user has chosen a respective news category. I want this category placed once above the first news summary entry.

Code: Select all

<h1>{$category_label} {$entry->category}</h1>
...or...

Code: Select all

<h1>{$category_label} {$item->category}</h1>
...or even

Code: Select all

<h1>{$category_label} {$category_name}</h1>
...don't work properly. The category label is shown ("Kategorie:" in german), but the category itself is not...

How can I extract the category name out of the entry array? My smarty knowledge is very poor yet...

Re: How to extract category names from news list?

Posted: Thu Jul 12, 2007 5:11 pm
by Michael AC
Solved it!

Using...

Code: Select all

<h1>{$category_label} {$param_category}</h1>
..is what I needed.

How to find out, what variables are used? Place {get_template_vars} within your template and all variables are shown.