Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Profiterole 232 posts 264 karma points
    Jan 27, 2011 @ 00:46
    Profiterole
    0

    Macro parameters from another node

    Hi, I'll try to explain myself best I can. I have a master template for my header and my footer and subtemplate for body parts.

    In my header, I call a macro that should be on each page. Parameters of this macro is called from the Runwayhomepage, so when I'm on the homepage it's ok, but when I go to a subpage, the macro doesn't work because it doesn't find the parameters on the page I'm (textpage doctype). I want it to look on homepage node to get the values.

    This is what's in my master template :

    <umbraco:Macro uniqueNode="[#trueFalse]" uniqueNodeNumber="[#contentPicker]" Alias="AP_banniere_prof" runat="server" />

    So on my doctype Runway Homepage I've set a contentPicker and a true/false values to fill the [#blabla] in the macro. So when I'm on the homepage it works, but when I'm on another page, it can't find the value of both [#blabla]. How, in xslt, can I say ''even if I'm another page, look at homepage values for these parameters''?

     

    Thank you

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 8x admin c-trib
    Jan 27, 2011 @ 00:48
    Chriztian Steinmeier
    0

    Hi Profiterole,

    That's what you use the "Recursive" checkbox for when inserting the macro.

    /Chriztian

  • Profiterole 232 posts 264 karma points
    Jan 27, 2011 @ 01:07
    Profiterole
    0

    There's no "Recursive" checkbox when I insert macro. Only when I insert page field. But if I find the "Recursive" checkbox, how this macro will know where to get the values of the parameters if there's any on the currentPage?

    Thank you for your help

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 8x admin c-trib
    Jan 27, 2011 @ 01:20
    Chriztian Steinmeier
    0

    Ah - sorry, too quick there.

    Take a look at this: http://our.umbraco.org/wiki/reference/templates/umbracomacro-element/macro-parameters/advanced-macro-parameter-syntax

    You can substitute a dollar-sign ($) for the hash (#) to get the recursive behavior in a macro.

    So Umbraco will take the value from the closest parent page that has a value for the property specified. If none are specified it'll end up on the Homepage. 

    /Chriztian

  • Profiterole 232 posts 264 karma points
    Jan 27, 2011 @ 02:49
    Profiterole
    0

    Wow, what a great trick I wasn't aware of!! Thank a lot Chriztian!

Please Sign in or register to post replies

Write your reply to:

Draft