Page 1 of 1

News Categories Question

Posted: Thu May 01, 2008 3:43 am
by malarky_moose
I'm new to this, and I'm not even too sure this is the right part of the BB to post in, but...


I'm wondering if there is a way to assign different templates to different categories? for example if there were 3 categories of news: world, local, celebrity gossip; could i assign a unique template to each? currently i am using "{news browsecat="1" detailpage='News'}", but that assigns one template for all categories. i've searched the forums, but haven't come up with much... any help is apreciated.

Re: News Categories Question

Posted: Thu May 01, 2008 6:19 am
by relic
hi there,

just put this in your page:

Code: Select all

{news number='8' summarytemplate="templatename" 
                      category="catname" detailpage="blah blah"}
hope that helps

dave

Re: News Categories Question

Posted: Thu May 01, 2008 11:09 pm
by malarky_moose
thanks for the reply.
maybe there is some way to use a variable within the parameter? for example:

Code: Select all

{news number='8' detailpage="$node.news_category_name"}
i'm no programmer, but it would be helpful to know if this is even possible or i should just give up. would be nice if it worked!

Re: News Categories Question

Posted: Thu May 01, 2008 11:44 pm
by calguy1000
hmmm, I've looked at this and it's possible, but it is not a simple task.

I'd do it with a new browsecat template in the News module, and use the module_action_link plugin out of CGSimpleSmarty.

I'd start by changing this text in the template:

Code: Select all

{if $node.count > 0}
	<a href="{$node.url}">{$node.news_category_name}</a> ({$node.count}){else}<span>{$node.news_category_name} (0)</span>{/if}
to

Code: Select all

{if $node.count > 0}
   {module_action_link module='News' action='summary' category=$node.news_category_name summarytemplate=$node.news_category_name}
{/if}
That'll require you to setup a summary template with the same name as the category name.
You can play with the parameters from there.

Re: News Categories Question

Posted: Fri May 02, 2008 12:00 am
by malarky_moose
wow. this might be a little over my head. i'd figured on the template and category names being the same. but i don't know what a plugin is or how to use it... is it just a file that i upload somewhere? is it free? thanks for your thoughtful reply. perhaps there is a way to link to specific pages instead? basically i want a viewer to be able to click on one of the summaries, and if the category is, say, celebrity gossip, then items in the sidebar would reflect that, and if the category is world news, then the sidebar would reflect that instead. well i hope i'm making sense anyways. thanks again.