Page 1 of 1

Display a specific news category on a single page

Posted: Mon Feb 02, 2009 1:13 pm
by andy25
Does anyone know how i can use the categories in the news module to distinguish news items which should be displayed on specific areas of the site.

For example if you were logged in a members only area you may have a seperate category for members only news.  Therefore i would only want to display these items and not a browsable category list.

Any help would be appreciated.

Re: Display a specific news category on a single page

Posted: Mon Feb 02, 2009 3:59 pm
by stevew
Create a category, e.g. "members news" (and, if you want, separate members news summary and detail templates) and on the members news page put the tag {news category="members news" summarytemplate="members news summary template" detailtemplate="members news detail template"}.

When you create members news articles, make sure they use the "members news" category.

Re: Display a specific news category on a single page

Posted: Mon Feb 02, 2009 4:04 pm
by andy25
You're a star.  That worked perfectly. 
Thanks.

Whilst you're on...ive uploaded attachements to a specific news item and all the others are registering an attachment except the one its actually associated with...in the admin i can see it attached correctly to the news article. 

Here is the code i used in the template:

  {if $field->type == 'file'}
    file_location}/{$field->value}" class="pdf">{$field->name}
  {/if}

Am i doing something wrong?

Re: Display a specific news category on a single page

Posted: Mon Feb 02, 2009 6:55 pm
by stevew
Have you tried with
{if $field->type == 'file'}
file_location}/{$field->value}"/>
{/if}
?
According to the default template in the latest version of News:
"this template assumes that every file uploaded is an image of some sort, because News doesn't distinguish"

Re: Display a specific news category on a single page

Posted: Tue Feb 03, 2009 9:09 am
by andy25
Yeh this is a problem because they could be PDF's as well.  So it has to be an href.  Unfortunately that example wont work.
Thank you for your input though.

Andy