<insert div from macro here with a class name based on current document type> <asp:ContentPlaceHolder ID="AdeptMasterContentPlaceHolder" runat="server"></asp:ContentPlaceHolder>
<close div from macro here> </form> </div>
or alternatively generate the body div above and append a class name using the macro..
I was wondering how you actually do that where a macro can generate content before then after the template markup.. I was thinking of just rendering the opening tag using the macro but thought surely there must be a better way
Yeah it could be that if it's easier.. i was thinking of just using the macro to render the opening div tag but was wondering if there was an alternative..
Instead of using a macro, could also just make the <div runat="server"... and set the class attribute via the masterpage.
How is the class name generated ? If it's a property of a node then the umbraco:item control with the insertTextBefore and insertTextAfter attributes could be used.
XSLT Macro Wrap Page In A Div
Hi all,
I want to generate a macro that will wrap some content in my template in a div.
<div id="body">
<form id="AdeptMasterForm" runat="server">
<insert div from macro here with a class name based on current document type>
<asp:ContentPlaceHolder ID="AdeptMasterContentPlaceHolder" runat="server"></asp:ContentPlaceHolder>
<close div from macro here>
</form>
</div>
or alternatively generate the body div above and append a class name using the macro..
I was wondering how you actually do that where a macro can generate content before then after the template markup.. I was thinking of just rendering the opening tag using the macro but thought surely there must be a better way
Hi Tom,
Is it just the class name of the div that needs to be generated ? ie. the closing </div> always exists ?
Hi Hendy
Yeah it could be that if it's easier.. i was thinking of just using the macro to render the opening div tag but was wondering if there was an alternative..
Cheers,
Tom
Instead of using a macro, could also just make the <div runat="server"... and set the class attribute via the masterpage.
How is the class name generated ? If it's a property of a node then the umbraco:item control with the insertTextBefore and insertTextAfter attributes could be used.
HTH,
Hendy
Hi Hendy..
basically what i wanted to do was render
<div class="SomeCategoryName"> where the current or ancestor has an instance of a certain document type
ie category - correct doctype
child category 1
other child category 2
some other category - not correct doc type
invalid child category
so for example "child category 1" and "other child category 2" and "category" would all get something like
<div class="content categoryNodeProperty>
and "some other category" & "invalid child category" would just get <div class="content">
Hi Hendy,
Just like to thank you for your umbraco:item solution. Perfect for my requirement, of allowing a page to dictate what colour scheme to use.
<umbraco:item field="colourScheme" recursive='true' insertTextBefore="<div id='CS-" insertTextAfter="'>" runat="server"/>
outputs perfectly
<div id='CS-#'>
can now change which colour scheme a page uses purely by adding a colourScheme field to Doc type.
It's easy when you know how :)
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.