[SOLVED] Link category in the news detail page.

General project discussion. NOT for help questions.
Post Reply
User avatar
FAB
Forum Members
Forum Members
Posts: 19
Joined: Tue Feb 24, 2009 9:38 am

[SOLVED] Link category in the news detail page.

Post 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.
Last edited by FAB on Sat Dec 05, 2009 9:15 am, edited 1 time in total.
Peciura

Re: Link category in the news detail page.

Post 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}
User avatar
FAB
Forum Members
Forum Members
Posts: 19
Joined: Tue Feb 24, 2009 9:38 am

Re: Link category in the news detail page.

Post by FAB »

Compliments !!  ;D  ;D

Works fine !

THANK YOU
rick1980
New Member
New Member
Posts: 7
Joined: Fri Feb 04, 2011 7:15 pm

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

Post 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
rick1980
New Member
New Member
Posts: 7
Joined: Fri Feb 04, 2011 7:15 pm

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

Post 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
carasmo
Power Poster
Power Poster
Posts: 506
Joined: Thu Feb 08, 2007 6:11 pm

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

Post by carasmo »

That's for CGblog, do you have the one for news? Thanks!
Post Reply

Return to “General Discussion”