Copied to clipboard

Flag this post as spam?

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


  • Luuk Krijnen 12 posts 66 karma points
    Aug 26, 2012 @ 10:46
    Luuk Krijnen
    0

    inheritance for fields used in macros

    Hi All,

    i've read something about inheritance to be used by fields to field it's value in one of it's ancestors.

    Now i've created a macro (Usercontrol) that is provided by a username an password for showing picasa webalbums. the parent page is used for showing all albums. It's child page is used showing photos in the album. Both page should be provided by the same username and password.

    The albums pages are provided a username and password by using a pageproperty

     

    incode:

    <umbraco:Macro GoogleUsername="[#googleUsername]" GooglePassword="[#googlePassword]" Alias="picasaGallery" runat="server"></umbraco:Macro>

    is it possible to inherit username and password in the child using this kind of syntax?

    Kind regards,

    Luuk Krijnen

  • Dan 1285 posts 3917 karma points c-trib
    Aug 26, 2012 @ 12:14
    Dan
    0

    Hi Luuk,

    Yes, this is possible.  There's a reference on the wiki about this, called advanced parameter syntax. You basically want to use a dollar sign instead of a hash in your macro properties, so you'd have:

     <umbraco:Macro GoogleUsername="[$googleUsername]" GooglePassword="[$googlePassword]" Alias="picasaGallery" runat="server"></umbraco:Macro>

    A dollar sign means that the property is recursive, so if the value isn't set on your current node it traverses up the parent nodes until a value is found.

    Hope this helps...

  • David 57 posts 80 karma points
    Oct 31, 2012 @ 20:27
    David
    0

    Dan,

    I have a doc2form macro that I try to do this very thing with and the [$siteEmailAddress] does not traverse up the parent node.  At least its not for me.  Its rather irritating. I can get the value of the field to display if I do it as a page field like so

    <umbraco:Item field="siteEmailAddress" recursive="true" runat="server">umbraco:Item>


    but when done within the <umbraco:macro FormToEmailAddress3="[$siteEmailAddress]" .............>  it does not work

     

    Any ideas?

Please Sign in or register to post replies

Write your reply to:

Draft