I’ve been reading through the documentation recently, and I love the way MODx is working for me. It’s fast, simple, exactly what I’ve been wanting out of a CMS. Now here’s the question. I want friendly URL’s, and I don’t want to have to change a million things if I update the template. Now if I hard code the menu into it (it’s only going to be like 5 or 6 pages in the menu) what are the benefits/downsides of doing so? The documentation said to insert something like [[MenuSnippet?id=`0`&activelink=`active`]] after all the menu code? Or after each link? It was a little unclear.
Thanks!
If you have only 5 or 6 items in your menu and those menu items does not change, you can hardcode your menu in the template. But if they have any possibility to change and you think it must be better to build your menu dynamically (especially you need some dynamic CSS), you’d better use Wayfinder snippet.
-
☆ A M B ☆
- 24,524 Posts
Their are several menuing snippets, and Wayfinder is the one most commonly used; it comes with the default MODx installation. You put the [[Wayfinder? &startId=`0`]] tags where you want the menu to appear. Wayfinder (or any of the other menuing/listing snippets) will generate the menu based on the documents in the database.
http://www.muddydogpaws.com/development/wayfinder/features.html
If you only have a few menu items and they won’t be changing, as tkfm says, you can simply make a hard-coded menu. It is easier to put the menu in a chunk, and put the chunk tags {{menuchunk}} in the template where you want the menu to appear. It will save a bit on page generation overhead (if the pages are not cached), since the Wayfinder snippet goes through the database to gather all of your documents and generate the menu from them.
The Document Tree in the Manager will reflect the layout of your menu; it uses the same database information to display the virtual tree structure of your documents.