Page 1 of 1

Exclude a news category

Posted: Sun Sep 02, 2012 5:28 pm
by trainer
Hello,
I'm trying to exclude some categories from my news menu.
I've 'really' searched the forums but haven't found a way of doing it.

Eventually, I came up with this...
General .....(exclude)
Products ....(exclude)
.....sub_cat_a
.....sub_cat_b

Code: Select all

{news action="browsecat" browsecattemplate="mycats" summarytemplate="newslist"}
Category template = mycats

Code: Select all

{if $count > 0}
{foreach from=$cats item=node}

{if $node.news_category_name != 'General' && $node.news_category_name != 'Products'}
<a href="{$node.url}">{$node.news_category_name}</a><br>
{/if}

{/foreach}
{/if}
summarytemplate newslist

Code: Select all

<ul>
{foreach from=$items item=entry}
 <li><a href="{$entry->moreurl}" title="{$entry->title|cms_escape:htmlall}">{$entry->title|cms_escape}</a></li>
{/foreach}
</ul>
This appears to work but in my opinion - it's very messy (and probably not the best way to do it).

I would really appreciate if someone could point me at a 'better' (or more correct) way.

(I am not a programmer.)

Thanks :)

Re: Exclude a news category

Posted: Sun Sep 02, 2012 6:58 pm
by mrenigma
Well other than the option you suggested there are four alternatives:
  1. Use the category parameter to select each specific category you want shown
  2. Use CGBlog instead and use its notcategory parameter to hide the categories you don't want shown
  3. Go to the module forge and request this feature to be added to the News module
  4. Pay/ask someone to modify the News module to get this feature (obviously this would be the least beneficial as soon as the module got updated)

Re: Exclude a news category

Posted: Sun Sep 02, 2012 7:07 pm
by trainer
Thank you mrenigma :)
I'll take a look at CGBlog.