[SOLVED] Multiple menus with use_hierarchy set to true
[SOLVED] Multiple menus with use_hierarchy set to true
I have a question now when use_hierarchy is removed from config.php and instead always is set to "true" in version 1.8.
From reading this forum I've learned to create additional menus by creating a new page (with alias "menu2" in my example), disable "Show in Menu" for it and then create the menu items/pages as sub-pages. The additional menu is then showed by using a tag similar to {menu template="menu2template" start_page="menu2" start_level="2"}. After upgrading to version 1.8 and thus getting use_hierarchy=true, the urls to these menu items got an unwanted prefix, i.e. /menu2/. The same goes for urls in sitemap.xml created by the SiteMapMadeSimple module.
One could use the same method to create special listings, e.g. a travel directory that has a list of countries and possibly cities in a sub-level. All these listings are affected by the use_hierarchy=true as prefixes are added to the urls.
What is the solution to this new issue that was introduced in version 1.8?
From reading this forum I've learned to create additional menus by creating a new page (with alias "menu2" in my example), disable "Show in Menu" for it and then create the menu items/pages as sub-pages. The additional menu is then showed by using a tag similar to {menu template="menu2template" start_page="menu2" start_level="2"}. After upgrading to version 1.8 and thus getting use_hierarchy=true, the urls to these menu items got an unwanted prefix, i.e. /menu2/. The same goes for urls in sitemap.xml created by the SiteMapMadeSimple module.
One could use the same method to create special listings, e.g. a travel directory that has a list of countries and possibly cities in a sub-level. All these listings are affected by the use_hierarchy=true as prefixes are added to the urls.
What is the solution to this new issue that was introduced in version 1.8?
Last edited by wiseguy on Sun Aug 15, 2010 12:20 am, edited 1 time in total.
Re: Multiple menus with use_hierarchy set to true
to be honest I don't know why you’re doing it that way.. but.. here is a nifty thing to note and may help save your established sites..
http://localhost/sandy_1-8-beta/how-cms ... heets.html
http://localhost/sandy_1-8-beta/templat ... heets.html
that is the same thing... try it out..
so you could just add |replace:'how-cmsms-works/':'' and that would knock it out.. Just a thought.. but I would think you need to rethink how your are approaching your menus... I use submenus all the time and don't have this issue FWIW... hope this helps .. Cheers -Jeremy
http://localhost/sandy_1-8-beta/how-cms ... heets.html
http://localhost/sandy_1-8-beta/templat ... heets.html
that is the same thing... try it out..
so you could just add |replace:'how-cmsms-works/':'' and that would knock it out.. Just a thought.. but I would think you need to rethink how your are approaching your menus... I use submenus all the time and don't have this issue FWIW... hope this helps .. Cheers -Jeremy
Re: Multiple menus with use_hierarchy set to true
Interesting, I had no clue that would work. So to "convert" pre-1.8 sites to 1.8 I could modify the menu templates somehow to strip out the /menu2/ part from the urls? And what about sitemap.xml generated by SiteMapMadeSimple?JeremyBASS wrote: to be honest I don't know why you’re doing it that way..
Also, if you could please enlighten me with how you create your own sub-menus.
Thanks!
Re: Multiple menus with use_hierarchy set to true
I'm short on time.. so let’s do it the fast way.. Can you just send screen shots of the page list expanded out.. and some samples of what your menus are now as output.. Then you can see may-be an alt way to create the same thing that works more inline with the system? That work.. I don't have much time to spear so may-be someone else can jump in too, but menus can be pretty powerfully and flexible. Cheers -Jeremy
Re: Multiple menus with use_hierarchy set to true
I've tried it now without success, cleared cache as well.Dr.CSS wrote: Have you tried putting this back in your config file?...
$config['use_hierarchy'] = false;
JeremyBASS: Thanks for being helpful.
So far I've mainly used the described multiple menus method for creating footer menus which point to pages that should not be shown in the main menu, and the menus also differs in styling, e.g. horizontal with dash as separator instead of the vertical main menu.
For a project which I hope to start this week, I was about to use the same method for creating listings of countries and cities where some code and of course content will the unique for each page. I was also going to ask the forum how to sort the listings in alphabetic order, probably adding some sorting function into the menu template. And the urls should be like site.com/madrid/ or possibly site.com/spain/madrid/ but not e.g. site.com/destinations/spain/madrid/.
The more flexibility and choices you have to format the urls, the better. There's a reason behind why seo plugins are so popular for other cmses as well.
Re: Multiple menus with use_hierarchy set to true
Hey,
I'm having the same problem, I used the same method for multiple menus and now it is showing all the children in the URL.
JeremyBASS, if you have time could you briefly explain how you avoid this issue? Or perhaps recommend a good site to read up on it?
Thanks!
I'm having the same problem, I used the same method for multiple menus and now it is showing all the children in the URL.
JeremyBASS, if you have time could you briefly explain how you avoid this issue? Or perhaps recommend a good site to read up on it?
Thanks!
Re: Multiple menus with use_hierarchy set to true
I posted a code change that works for my sites, and asked for comments on it, but the whole post was quickly removed by some anonymous moderator.
Please, can anyone here at least tell me what's wrong with discussing possible solutions?
Please, can anyone here at least tell me what's wrong with discussing possible solutions?
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: Multiple menus with use_hierarchy set to true
See what's in the forum rules.
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.
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.
Re: Multiple menus with use_hierarchy set to true
All right, got it. We're not allowed to discuss code examples in the forum, at least not if it has to do with the core.calguy1000 wrote: See what's in the forum rules.
It would be highly appreciated if anyone can suggest a pragmatic approach for finding an alternative non-hierarchical url solution (which does not require changes to the core).
Re: Multiple menus with use_hierarchy set to true
Hey, did you solve the problem? I'm still stuck on this.
Re: Multiple menus with use_hierarchy set to true
i had the idea of a walkaround for this issue. in your menutemplate, replace
with
modify file prefix.
i would recommend the use of canonical urls:
because both, the hierarchy urls and the new urls still coexists. and therefore you have to tell google the right url! this is canonical url!
hope this helps!
Code: Select all
href="{$node->url}"
Code: Select all
href="{$node->alias}.html"
i would recommend the use of canonical urls:
Code: Select all
{if isset($canonical)}<link rel="canonical" href="{$canonical}" />{elseif isset($content_obj)}<link rel="canonical" href="{root_url}/{$content_obj->mAlias}.html" />{/if}
hope this helps!
Re: Multiple menus with use_hierarchy set to true
This workaround mind be Ok for the Menus.
However, the {cms_selflink} tag used in the content of the pages will produce not-wanted URLs
However, the {cms_selflink} tag used in the content of the pages will produce not-wanted URLs
Re: Multiple menus with use_hierarchy set to true
I have read the few other threads about this.
Besides the issue of hacking core files is this the best way? what about other instances of href="{$node->url}" and in other places/templates?
or is there 'more official' way of having www.mydomain.com/alias.php
Besides the issue of hacking core files is this the best way? what about other instances of href="{$node->url}" and in other places/templates?
or is there 'more official' way of having www.mydomain.com/alias.php
Re: Multiple menus with use_hierarchy set to true
An unofficial, but easier way is the usage of a smarty output filter, which deletes the unwanted hierarchy from the html code. I don´t know how long this will work with new cmsms versions and I don´t know which modules should be defined as exceptions, but you can download a beta version of the plugin from my german (commercial) website. A short english readme.txt is in the zip-file.
At the moment I only couldn´t find a solution for my xml-sitemap (gsitemap.php) as it doesn´t use smarty.
At the moment I only couldn´t find a solution for my xml-sitemap (gsitemap.php) as it doesn´t use smarty.
Last edited by LeisureLarry on Sat Aug 07, 2010 12:39 pm, edited 1 time in total.