Exclude a news category

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.
Post Reply
User avatar
trainer
Forum Members
Forum Members
Posts: 43
Joined: Sat Jun 19, 2010 9:58 am

Exclude a news category

Post 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 :)
CMSMS 1.11.1
PHP Version 5.3.3-1ubuntu9.7
MySQL 4.1.22
Apache 2.2.16 (Ubuntu)
Linux 2.6.35-22
mrenigma
Forum Members
Forum Members
Posts: 48
Joined: Fri Aug 05, 2011 3:43 pm
Location: London, United Kingdom

Re: Exclude a news category

Post 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)
~ Life is like water, every movement you make changes the way it flows ~
User avatar
trainer
Forum Members
Forum Members
Posts: 43
Joined: Sat Jun 19, 2010 9:58 am

Re: Exclude a news category

Post by trainer »

Thank you mrenigma :)
I'll take a look at CGBlog.
CMSMS 1.11.1
PHP Version 5.3.3-1ubuntu9.7
MySQL 4.1.22
Apache 2.2.16 (Ubuntu)
Linux 2.6.35-22
Post Reply

Return to “CMSMS Core”