adrianmak Posted April 9, 2015 Share Posted April 9, 2015 Home +--menu-1 +---menu-1-1 +---menu-1-2 +---menu-1-3 +---menu-1-4 +--menu-2 +---menu-2-1 +---menu-2-2 +---menu-2-3 +--menu-3 +--menu-4 menu-1 and menu-2 which are associated to a page, but without content. It just a sub-menu holder, click menu-1, or menu-2 to expand it's child menu how to make clicking of menu-1 and menu-2 without opening menu- and menu-2 page ? Link to comment Share on other sites More sharing options...
marcus Posted April 9, 2015 Share Posted April 9, 2015 In these cases I'd give the pages menu-1 and menu-2 a template, consisting of: <?php /** * Template: First Child redirect * */ if($page->numChildren) $session->redirect($page->child()->url); So that a click on them redirects to menu-1-1 or menu 2-1 respectively. More: https://processwire-recipes.com/recipes/quick-first-child-redirect/ Link to comment Share on other sites More sharing options...
SiNNuT Posted April 9, 2015 Share Posted April 9, 2015 You should take care of that in your menu generating code, so that menu-1 and menu-2 are somehow recognizable for the needed javascript and not link to a page. You can hardcode it or take an approach like https://processwire.com/talk/topic/4261-parent-pages-and-their-behavior/ You should also decide what you show when you manually go to the container url, see some options in the above thread. 1 Link to comment Share on other sites More sharing options...
Macrura Posted April 9, 2015 Share Posted April 9, 2015 in your custom menu pages, you just need to have a menu override. Link to comment Share on other sites More sharing options...
adrianmak Posted April 9, 2015 Author Share Posted April 9, 2015 in your custom menu pages, you just need to have a menu override. menu_ex.png where could I find URL override option in page or page template? Link to comment Share on other sites More sharing options...
Macrura Posted April 9, 2015 Share Posted April 9, 2015 you just make a custom menu tree using a menu type template... Link to comment Share on other sites More sharing options...
adrianmak Posted April 10, 2015 Author Share Posted April 10, 2015 you just make a custom menu tree using a menu type template... Thank you for redirect to your post. I have a few questions not quit understood/clear of your custom menu tree implementation. 1. the 'Main Menu' page tree is a separate tree from the site root or still under a child of the site root ? 2. Isn't the 'Main Menu' structures are inputted manually one by one ? Link to comment Share on other sites More sharing options...
Macrura Posted April 10, 2015 Share Posted April 10, 2015 ok - so for the custom menu, the way i did it in the past on many sites was with a hidden branch of the page tree, usually underneath a page called Settings; Most sites i build do require the menu to be very specific and there is absolutely no way that the menu displayed in the front end can be based on the page tree; in my opinion, the page tree being used as the front end menu is only for very small and simple sites; anything more complicated requires you to build your own menu, and now that we have Kongondo's menu module, this is even easier than ever. If you take a look at that module, there may very well be a way to assign a custom URL override to any menu item; i have not tried it yet, but i am planning on using it for the next site i release which is now in admin development. once you have made your menu page tree (yes manually, one by one), and on each of those items selected the page that the menu item will link to, you can use that code to output your menu, and modify it to your needs in terms of menu markup. You can also configure the override field to be always used if it is populated. If you wish to use the page tree as-is to generate your menu, that is pretty much the same thing; you just need a field to override the page's URL in the menu and then use your output code to check if that field is populated and swap out the value of that field with the default URL of the page. 2 Link to comment Share on other sites More sharing options...
kongondo Posted April 10, 2015 Share Posted April 10, 2015 Most sites i build do require the menu to be very specific and there is absolutely no way that the menu displayed in the front end can be based on the page tree; in my opinion, the page tree being used as the front end menu is only for very small and simple sites; anything more complicated requires you to build your own menu, and now that we have Kongondo's menu module, this is even easier than ever. If you take a look at that module, there may very well be a way to assign a custom URL override to any menu item; i have not tried it yet, but i am planning on using it for the next site i release which is now in admin development. Currently this is possibly only with Custom Menu Item (external links) where you can provide # as a URL. At the moment, PW pages' URLs are non-editable but I can easily provide an option to make them editable if such a feature was requested (preferably via Github).. Link to comment Share on other sites More sharing options...
Macrura Posted April 10, 2015 Share Posted April 10, 2015 Currently this is possibly only with Custom Menu Item (external links) where you can provide # as a URL. At the moment, PW pages' URLs are non-editable but I can easily provide an option to make them editable if such a feature was requested (preferably via Github).. that sounds like it would be perfect and exactly what i was hoping for! i can't think of any reason to edit the PW urls; the external link option should be all that is needed; i'll be testing your module over the next week and will report back on that topic. i think for adrianmak's usage, the menu builder module would be a time saver over doing it the old way with page tree, or using a field on the page to override the page's url for menu purposes. Link to comment Share on other sites More sharing options...
kongondo Posted April 10, 2015 Share Posted April 10, 2015 that sounds like it would be perfect and exactly what i was hoping for! i can't think of any reason to edit the PW urls; the external link option should be all that is needed;.... You are right...would certainly make life easier....Just Create a 'dummy link' and bob's your uncle.... ...I could then focus on other pending modules Link to comment Share on other sites More sharing options...
adrianmak Posted April 11, 2015 Author Share Posted April 11, 2015 that sounds like it would be perfect and exactly what i was hoping for! i can't think of any reason to edit the PW urls; the external link option should be all that is needed; i'll be testing your module over the next week and will report back on that topic. i think for adrianmak's usage, the menu builder module would be a time saver over doing it the old way with page tree, or using a field on the page to override the page's url for menu purposes. Kongondo just pointed out that pw's url is not editable. Isn't the custom menu override url option is just for menu markup prupose, but it's not really override page's url Link to comment Share on other sites More sharing options...
Macrura Posted April 11, 2015 Share Posted April 11, 2015 not sure what you mean.. we are making a menu right? so all that matters is the url you want on the menu item, and that is markup. the URL override in my example means that if a URL is entered into that field, it overrides anything selected in the page select. It has nothing to do with processwire pages at all.. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now