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

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
Michael AC

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

Post 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...
Last edited by Michael AC on Thu Jul 12, 2007 5:12 pm, edited 1 time in total.
Michael AC

Re: How to extract category names from news list?

Post 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.
Locked

Return to “CMSMS Core”