It is implemented as a .NET control. As you can imagine I am trying to use a template on many pages, each of which can use a different macro on it. I cant post the code at this stage but it and the others I intend to use work fine when I hardcode the alias.
It sounds like you are trying to dynamically change the macro that is rendered on the template at run time based on which page is being rendered. Is that right? so all pages might have common header, footer, navigation, but the news page loads the news macro and the calendar page loads the calendar macro or something along those lines?
In that case, could the .NET control handle all the logic that you are trying to dictate with the property? For example, using request.querystring inside the control and letting it vary the output based on the querystring or URL, etc? Or if your architecture allows, just keep the macros seperated out into different logical parts and then add the specific macro to the page itself in the content tree - just use the insert macro button in the rich text editor for the page.
Specify macro alias from generic property
I have made a Document Type that allows a macro property to be set. Within the page template I have the following;
<umbraco:Macro Alias="[#PageMacro]" runat="server" ></umbraco:Macro>
However the macro is not being executed. Any tips as to what I may be doing wrong?
Hi Mark
I'm not sure it's possible to use page values in the alias attribute...but I could be wrong here.
Is the macro working if you hardcode the value into the alias?
/Jan
Hi Jan,
Yes the macro works fine when hardcoded. I thought perhaps using XSLT to produce the <umbraco:Macro> might work however I have had no luck.
Mark,
Does your macro use XSLT or a .NET user control? Are you able to post the XSLT or .NET code to see how the property is implemented?
Brad
It is implemented as a .NET control. As you can imagine I am trying to use a template on many pages, each of which can use a different macro on it. I cant post the code at this stage but it and the others I intend to use work fine when I hardcode the alias.
Mark-
It sounds like you are trying to dynamically change the macro that is rendered on the template at run time based on which page is being rendered. Is that right? so all pages might have common header, footer, navigation, but the news page loads the news macro and the calendar page loads the calendar macro or something along those lines?
Brad
Yes that is correct :)
Mark-
In that case, could the .NET control handle all the logic that you are trying to dictate with the property? For example, using request.querystring inside the control and letting it vary the output based on the querystring or URL, etc? Or if your architecture allows, just keep the macros seperated out into different logical parts and then add the specific macro to the page itself in the content tree - just use the insert macro button in the rich text editor for the page.
Brad
I like the idea of having a .NET control that is responsible for determining the output. I will investigate this, thank you :)
There still is the greater issue of why can't I see the macro alias from a page property... perhaps it is a bug?
In my experience, passing variables from the macro to the .NET control is something like the following:
1) create public properties in your usercontrol:
2) pass the values into the code from the macro like this:
...but that still does not make the property dynamic at run time. It is still "static" in the declarative code.
is working on a reply...