I'm new to Umbraco, so a little clueless, so please bear with me.
I'm building a site where the content editors want to be able to manually specify which side menu gets displayed on new pages as they create them.
Now I'm happy with how you can 'hook' a partial view macro file into a template, so I was planning to have each (static) side menu as one of these.
In my Data Type of "content page", I can add a tab and call it "Select Side Menu" and then add an editor type of Macro Container. This all looks good so far as I can specify all of the side menu partial views as a dropdown list.
My problem is that I've no idea what code to add to my template in order to display the selected side menu.
Obviously I might be approaching all of this wrong but if I am on the right lines, can anyone help me finish this off please?
If you mean that you have a Document Type called "Content page" and it has a property called "Select Side Menu" of datatype "Marco Container", and you want to render the macro html in your template, you can write this:
How to use macros to define side menus
Hi,
I'm new to Umbraco, so a little clueless, so please bear with me.
I'm building a site where the content editors want to be able to manually specify which side menu gets displayed on new pages as they create them.
Now I'm happy with how you can 'hook' a partial view macro file into a template, so I was planning to have each (static) side menu as one of these.
In my Data Type of "content page", I can add a tab and call it "Select Side Menu" and then add an editor type of Macro Container. This all looks good so far as I can specify all of the side menu partial views as a dropdown list.
My problem is that I've no idea what code to add to my template in order to display the selected side menu.
Obviously I might be approaching all of this wrong but if I am on the right lines, can anyone help me finish this off please?
thanks
Dave
Hi Dave.
If you mean that you have a Document Type called "
Content page
" and it has a property called "Select Side Menu
" of datatype "Marco Container
", and you want to render the macro html in your template, you can write this:Thanks Dennis, that's exactly what I meant and it worked a treat!
I do tend to struggle with knowing/finding these snippets of code.
Much appreciated
Dave
Awsome Dave, happy that i could be of help! Good luck with the rest of the site! :)
is working on a reply...