I have never tried it, and don't quite understand why you would do it? If you share a usecase it might make more sense - otherwise you might want to rethink the logic.
Depending on how you've got your macro set-up, and how you are thinking of passing the other macro through as a parameter, then it should be possible.
The scenario I tend to use is with the Macro Picker data-type. If I use it on one of my doc-types with an alias of "macro", then in my XSLT, I can use the following:
i have a macro return a list of windows: <umbraco:macro windowtype="{another_macro_calls}" alias="window_list" runat="server" />
you would think i should call the "another_macro_calls" in the window_list xslt file, but unfortunately, that sub macro is calling a user control. so to use the umbraco.library:rendermacro() function to call a macro which link to a user control, it refused to work.
any help, suggestions, hints would gladly appreciated!
question is, what is @requestValueKey ? i cant find any example of anyone using this. if you happened to do this once before, please give me some insight.
also, i tried to declare an asp.net variable like: <% dim lTest as string = '<umbraco:Item field="note" runat="server" />' %> but it kept return error Expression expected. have i missed something ? or is it even possible to declare a variable in asp.net, however, i know for sure i can do the same but in javascript inside a <script> table..... in a template.
The "[@requestValueKey]" is an advanced Macro parameter field value type. The @ symbol-prefix is for items in the Request object (anything from Request.Form, Request.QueryString, etc). There are other special Macro parameter field types for page property fields and cookie values. The documentation is here:
For your second problem, it's a simple misunderstanding of how server-side (Classic ASP) works with the ASP.NET Framework. You can not assign server-controls to inline-code variables. It's far too much to explain in this short forum post - you might want to invest in an ASP.NET book, or online tutorials. Anyway, the simple answer to what you want to do would be like this:
<% Dim lTest As String = umbraco.library.GetItem("note") %>
(It's been a while since I've written any VB.NET, was really holding back putting a semi-colon on the end!!)
[@requestValueKey] takes the querystring value for the key specified as requestValueKey and feeds this parameter to your macro (which its passed on to a xslt or user control.
how to call macro as a param in another macro ?
have anyone out there ever tried to call a macro as a param in another macro ? i've look everywhere online but no luck, please help
I have never tried it, and don't quite understand why you would do it? If you share a usecase it might make more sense - otherwise you might want to rethink the logic.
- Morten
Hi bev0,
Depending on how you've got your macro set-up, and how you are thinking of passing the other macro through as a parameter, then it should be possible.
The scenario I tend to use is with the Macro Picker data-type. If I use it on one of my doc-types with an alias of "macro", then in my XSLT, I can use the following:
That will render the macro. But remember, (and this is important), this only works with XSLT macros, NOT .NET user-controls (ASCX).
Good luck, Lee.
example:
i have a macro return a list of windows: <umbraco:macro windowtype="{another_macro_calls}" alias="window_list" runat="server" />
you would think i should call the "another_macro_calls" in the window_list xslt file, but unfortunately, that sub macro is calling a user control. so to use the umbraco.library:rendermacro() function to call a macro which link to a user control, it refused to work.
any help, suggestions, hints would gladly appreciated!
thanks
How about creating an XSLT Extension of the functionality in your usercontrol, so you can use it from within your first XSLT..?
Or if you need your usercontrol to do something with the list of windows why not get the list from the usercontrol?
Maybe you can elaborate on what your usercontrol has to do with the list of windows?
in umbraco version 4, i saw the wiki has another way to provide params.
<umbraco:macro alias="RenderProperties" pagevalue="[@requestValueKey]" runat="server"/>
question is, what is @requestValueKey ? i cant find any example of anyone using this. if you happened to do this once before, please give me some insight.
also, i tried to declare an asp.net variable like: <% dim lTest as string = '<umbraco:Item field="note" runat="server" />' %> but it kept return error Expression expected. have i missed something ? or is it even possible to declare a variable in asp.net, however, i know for sure i can do the same but in javascript inside a <script> table..... in a template.
Hi bev0,
The "[@requestValueKey]" is an advanced Macro parameter field value type. The @ symbol-prefix is for items in the Request object (anything from Request.Form, Request.QueryString, etc). There are other special Macro parameter field types for page property fields and cookie values. The documentation is here:
http://our.umbraco.org/wiki/reference/templates/umbracomacro-element/macro-parameters/advanced-macro-parameter-syntax
For your second problem, it's a simple misunderstanding of how server-side (Classic ASP) works with the ASP.NET Framework. You can not assign server-controls to inline-code variables. It's far too much to explain in this short forum post - you might want to invest in an ASP.NET book, or online tutorials. Anyway, the simple answer to what you want to do would be like this:
(It's been a while since I've written any VB.NET, was really holding back putting a semi-colon on the end!!)
Good luck, Lee.
Hi bev0,
http://our.umbraco.org/wiki/reference/templates/umbracomacro-element/macro-parameters/advanced-macro-parameter-syntax
[@requestValueKey] takes the querystring value for the key specified as requestValueKey and feeds this parameter to your macro (which its passed on to a xslt or user control.
So, if you're browsing http://www.domain.com/my-page.aspx?page=1 and in the template of the document, you've added
then the value "1" will be passed as value for the parameter pagevalue
Does that make more sense now?
Cheers,
/Dirk
thank you everyone for taking your time and reply my questions, it certainly helped me quite a bit !
is working on a reply...