excludeprefix and includeprefix

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
georgechr
Forum Members
Forum Members
Posts: 96
Joined: Tue Sep 13, 2011 6:02 am

excludeprefix and includeprefix

Post by georgechr »

Dont know if this is the right place to answer, please move it to the according one if not.

Well i have a site with 3 menus. Each of the menus has children.
The only way i managed to make it work is using the excludeprefix like below:

Code: Select all

{menu template="CSSMENU_DEFAULT_HORIZONTAL" start_level="2" excludeprefix="diethneis_sxeseis,ekdilwseis,koinwniki_allilegii,
announcements,useful_links,members_area"}

{menu template="CSSMENU_DEFAULT_HORIZONTAL_2" start_level="2" excludeprefix="o_tektonismos,megali_stoa,diethneis_sxeseis,ekdilwseis,
koinwniki_allilegii,announcements,useful_links,contact,register"}

{menu template="CSSMENU_DEFAULT_VERTICAL" start_level="2" excludeprefix="o_tektonismos,megali_stoa,contact,
members_area,register"}
My problem though is that this means that everytime i add a new link i will have to go manually and edit all my templates. All of my menus have children therefore i need something that will only show some items with their children

I tried using includeprefix to show only what i wanted, but it does not show children.

What is the way to go for this?

Thanks in advance
spcherub
Power Poster
Power Poster
Posts: 402
Joined: Fri Jun 06, 2008 5:54 pm

Re: excludeprefix and includeprefix

Post by spcherub »

It is hard to respond to your question without knowing how your pages are structured (page hierarchy in the admin tool) and how the menus need to be rendered on the public facing page.

Have you looked into the "number_of_levels" parameter of the {menu} tag? This allow you to limited the number of levels that are exposed via that call.

-S
georgechr
Forum Members
Forum Members
Posts: 96
Joined: Tue Sep 13, 2011 6:02 am

Re: excludeprefix and includeprefix

Post by georgechr »

this is how my hierarchy goes.

Image

So if i create another language for my site it will be number 2 etc.

i am using number of levels to not show the home page.
staartmees
Power Poster
Power Poster
Posts: 1049
Joined: Wed Mar 19, 2008 4:54 pm

Re: excludeprefix and includeprefix

Post by staartmees »

you can use the includeprefix if you manually change the page-alias of each page. The pages which belong in the first menu all get a page-alias that starts with m1- , the second menu m2- and the third menu with m3-

Code: Select all

{menu template="CSSMENU_DEFAULT_HORIZONTAL" start_level="2" includeprefix="m1-"}

{menu template="CSSMENU_DEFAULT_HORIZONTAL_2" start_level="2" includeprefix="m2-"}

{menu template="CSSMENU_DEFAULT_VERTICAL" start_level="2" includeprefix="m3-"}


georgechr
Forum Members
Forum Members
Posts: 96
Joined: Tue Sep 13, 2011 6:02 am

Re: excludeprefix and includeprefix

Post by georgechr »

it worked!!

Thanks a million. You saved me from weeks of trying :)
Post Reply

Return to “CMSMS Core”