Copied to clipboard

Flag this post as spam?

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


  • Marino Simic 16 posts 53 karma points
    Aug 26, 2009 @ 20:52
    Marino Simic
    0

    A few questions about macros in templates and architecture

    I've been trying to figure out two things but without luck.

    1. Parsing of the template:

    I need to put a macro on the template which takes an umbraco:Field value as the value of one parameter.

    Is this legal to do in umbraco? If yes, how. If not what is the alternative.

    Example: Put a macro which takes the url of an uploaded flash animation from the content node (from a document type property) as a parameter. The macro renders the flash animation. (I know how to do this and this is not the expected way but it is just for an example)

    Some legal form of this:

    <umbraco:Macro Alias="renderFlash" source="<umbraco:Item field="pageFlash" runat="server"/>" runat="server"></umbraco:Macro>

    2. Handling of multiple usercontrols on the same page and their communication:

    I'd like to make some sort of web application, where usercontrols would be placed on different places on the template. All of this controls are part of the same application and i need to change properties of one instance of some control from another instance of another control.

    Example:

    Have a listBooks control on the left side of the page change the currentBook property of the viewBook control in the middle of the screen.

    How do you do this in umbraco (some guidelines).

     

    Thanks!

     

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Aug 26, 2009 @ 21:23
    Dirk De Grave
    0

    Hi Marino

    1. Passing document properties to macro's is done throuhg a special syntax:

    <umbraco:Macro Alias="renderFlash" source="[#pageFlash]" runat="server"></umbraco:Macro>

    On a sidenote, you can also pass requeststring values (@request), recursive properties ($resursiveProperty) and cookie values (%cookie)

    2. Have seen some posts on that subject... will look it up...

     

    Cheers,

    /Dirk

  • Marino Simic 16 posts 53 karma points
    Aug 26, 2009 @ 21:49
    Marino Simic
    0

    Dirk, thanks for the tip about parameters for the macro. This is wondeful. I have created a macro for flash content that works inside the CDATA of the content by having a macro wrapper that parses the content for embedded macros and uses rendermacro on the 'true' macro to do the job.

    I was wondering how to invoke the 'true' macro from the template without using the wrapper that parses the CDATA since on the template i have the reference to the page node, as opposed when inside of a cdata property of a page.

    Now if i find a way of referencing different instances of controls on the same page at runtime i have everything i need.

     

    You have a beer for this ;)

Please Sign in or register to post replies

Write your reply to:

Draft