How do I work with menus in order to have complete control over them in C5?
Permalink
I have been beating my head against the wall trying to understand the PHP "Greek" inside the auto-nav block code. While I know PHP it is like Greek trying to understand OO code that is not commented and that I must go searching around inside the core code to in turn try and interpret some more to try and figure out what in the world the code does.
I can well enough create my own custom template for the auto-nav and that's that. Complete control over my own menu (though it is rather confusing that the auto-nav context menu still allows editing of a block that no longer does anything since my custom template code takes over completely and renders the editing of said block useless).
The problem with doing it all with my code inside either a custom block or a custom template for the auto-nav block is that my code does not automatically take into account new pages added such that one must go into my code manually and add links to new pages so that they show up in my menu. Not a problem for me but definitely for an end user.
So...what is the easiest way for me to retain complete control over a website navigation menu (i.e. styling it however I want, using whatever Javascript I want on it, whatever) while having it automatically update with any new pages added to a site through C5?
If I must work with auto-nav somehow to accomplish this...is there some sort of documentation somewhere that would give me the heads up on the PHP "Greek" referred to above or am I stuck having to wade into the code and through a process of trial and error (to see what happens when I disable some of the code and print_r's) figure out what it does (a time consuming exercise at best and a complete frustration at worst)?
Thanks.
Carlos
I can well enough create my own custom template for the auto-nav and that's that. Complete control over my own menu (though it is rather confusing that the auto-nav context menu still allows editing of a block that no longer does anything since my custom template code takes over completely and renders the editing of said block useless).
The problem with doing it all with my code inside either a custom block or a custom template for the auto-nav block is that my code does not automatically take into account new pages added such that one must go into my code manually and add links to new pages so that they show up in my menu. Not a problem for me but definitely for an end user.
So...what is the easiest way for me to retain complete control over a website navigation menu (i.e. styling it however I want, using whatever Javascript I want on it, whatever) while having it automatically update with any new pages added to a site through C5?
If I must work with auto-nav somehow to accomplish this...is there some sort of documentation somewhere that would give me the heads up on the PHP "Greek" referred to above or am I stuck having to wade into the code and through a process of trial and error (to see what happens when I disable some of the code and print_r's) figure out what it does (a time consuming exercise at best and a complete frustration at worst)?
Thanks.
Carlos
I agree that the built-in autonav template is quite messy (and don't even look at the controller code -- it will make your head spin!).
Because of that, I have found that the best approach to take in making menus look the way you want is to not mess with the template at all (or at least very minimally), and instead try to do all of the styling via CSS.
Can you give some details about what exactly it is you want to achieve with your nav menus? It's not really possible to give specific advice without knowing what it is you want to do.
Because of that, I have found that the best approach to take in making menus look the way you want is to not mess with the template at all (or at least very minimally), and instead try to do all of the styling via CSS.
Can you give some details about what exactly it is you want to achieve with your nav menus? It's not really possible to give specific advice without knowing what it is you want to do.
Both of you gave what I consider to be best answers so I can't pick between the two.
I'll put up my site in C5 later today and show it to you if that is okay to put a link to here (??). Rather than trying explain it in just words.
I figured it out yesterday and it's pretty nifty the way C5 allows me to have complete control over my menu while allowing me to change the presentation of the menu through custom templates or mainly CSS files.
Can't say I have completely figured things out but I am over the hump and will be playing some more with it today.
Discovering what I could use a file called view.css to control the presentation of view.php was big breakthrough. I had no idea that one could create such a CSS file.
Carlos
I'll put up my site in C5 later today and show it to you if that is okay to put a link to here (??). Rather than trying explain it in just words.
I figured it out yesterday and it's pretty nifty the way C5 allows me to have complete control over my menu while allowing me to change the presentation of the menu through custom templates or mainly CSS files.
Can't say I have completely figured things out but I am over the hump and will be playing some more with it today.
Discovering what I could use a file called view.css to control the presentation of view.php was big breakthrough. I had no idea that one could create such a CSS file.
Carlos
Other than that, digging through sample navigation files and how things interact is another helpful way to familiarize yourself with the overall setup.