News module taking category from menu text?

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
tristan
Dev Team Member
Dev Team Member
Posts: 375
Joined: Tue May 02, 2006 10:58 am

News module taking category from menu text?

Post by tristan »

Hi there,

I'm looking for a way to have the news module take the category from the menu text of that page. This would be really nice because this way I can still have one template for all the pages because I want each page to have a different news category. I'm  trying to do this:

Code: Select all

{cms_module module="news" category="{menu_text}"}
This however, obviously, doesn't work. Does anyone over here have a simple solution for this problem?

Kind regards,

Tristan
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: News module taking category from menu text?

Post by calguy1000 »

use the get_template_vars plugin (describe elsewhare in the forum) to see if the current menu text is exported as a variable.  if it is, then you should be able to do a:

Code: Select all

{cms_module module="news" category="$variable"}
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
mikemee
Forum Members
Forum Members
Posts: 20
Joined: Sun May 21, 2006 11:31 am

Re: News module taking category from menu text?

Post by mikemee »

Depending on your scenario, a value of $page works pretty well.  E.g. see http://forum.cmsmadesimple.org/http://p ... 664#p27664.
FinnK

Re: News module taking category from menu text?

Post by FinnK »

Why not make different (normal) pages with the news module displaying news from different categories - and naming the pages and menutexts accordingly?
- am I missing something?
Post Reply

Return to “CMSMS Core”