Page 1 of 1

[SOLVED] Link category in the news detail page.

Posted: Mon Nov 30, 2009 11:33 am
by FAB
Hello to everybody,
How can I show in the news detail page a link to the category related to the news ? In this way I would like to show, when clicking the category link, all the news related to selected category.

Sorry for my english.

Thanks.

Re: Link category in the news detail page.

Posted: Mon Nov 30, 2009 4:15 pm
by Peciura
1. Create page that will show news of appropriate category. Lets call it "test". Category is taken from $_GET variable member "news_category".

Code: Select all

{news category=$smarty.get.news_category detailpage="pagealias"}
2. In news detail template create link to "test" page with additional parameter "news_category"

Code: Select all

{capture assign='urlparam'}&news_category={$entry->category}{/capture}
{cms_selflink page='test' urlparam=$urlparam text=$entry->category}

Re: Link category in the news detail page.

Posted: Sat Dec 05, 2009 9:14 am
by FAB
Compliments !!  ;D  ;D

Works fine !

THANK YOU

Re: [SOLVED] Link category in the news detail page.

Posted: Sun Feb 06, 2011 4:42 pm
by rick1980
Hi,

Is there also a way to do this with pretty url's? Meaning that somehow the following code can be set in de detail page template.

Code: Select all

{foreach from=$categories item='one'}
  <li><a href="{$one.url}" title="{$one.name}">{$one.name}</a>&nbsp;({$one.count})</li>
{/foreach}

Thank you,
Rick

Re: [SOLVED] Link category in the news detail page.

Posted: Sun Feb 06, 2011 4:55 pm
by rick1980
With pretty ur's you can use the following on your summary page.

Code: Select all

{if $entry->categories}
<div class="CGBlogSummaryCategory">
{strip}
 {foreach from=$entry->categories item='one_category'}
	{foreach from=$categories item='one'}
		{if $one_category.name == $one.name}
 			<a href="{$one.url}" title="{$one.name}">{$one.name}</a>&nbsp;
		{/if}
	{/foreach}
 {/foreach}
{/strip}
</div>
{/if}
- Rick

Re: [SOLVED] Link category in the news detail page.

Posted: Mon Sep 17, 2012 4:08 am
by carasmo
That's for CGblog, do you have the one for news? Thanks!