Copied to clipboard

Flag this post as spam?

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


  • Garrett Fisher 341 posts 496 karma points
    Feb 19, 2010 @ 20:05
    Garrett Fisher
    0

    Macro in Content as opposed to Template

    Hi,

    I have a Macro which pulls in additional content for the sidebaron a per-page basis.  The problem is, on a certain page, I also need to pull in links to its subpages, which Also requires a Macro.  I don't think I can put an additional Macro INSIDE the XSLT file that the original Macro uses, so I decided to try putting the Macro in the "additional sidebar content" Content field.  It works in the sense that the links to the subpages DO appear in the CMS, but for some reason, do NOT appear on the site.  What's the story there? 

    Anybody have any ideas on how to accomplish this?  Do I just add More XSLT to the "additional sidebar content" Macro/XSLT which gets the subpages?  Thereason I don't want to do that is because then it will have to check what page it is on Every page in order to decide whether to Show it.

    What is the difference between putting a Macro in a Content field as opposed to a Template?  And why doesn't it display in the site  when I do it?

    Thanks,

    Garrett

  • Kim Andersen 1447 posts 2196 karma points MVP
    Feb 19, 2010 @ 20:16
    Kim Andersen
    0

    I'm not sure if I totally understand your question, but do you say that the problem is that the macro is renderes fine in the Richtext Editor in the backend, but not in the frontend?

    If this is the question, how do you render your content from the richtext editor?

    You could try out the umbraco.library:RenderMacroContent if you render the content from XSLT.

    /Kim A

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Feb 20, 2010 @ 09:49
    Douglas Robar
    0

    There's no real difference between a macro in the template and in the richtext editor (RTE)... they'll both output the macro result.

    But you will have to enable a macro to be used in the RTE because by default macros only appear in the list when inserting into templates. To change this, go to the Developer section of umbraco and expand the Macros portion of the tree. Select your macro and check the box for 'use in editor'. Save the macro. Now the macro can be selected when you click the Insert Macro button on the RTE's toolbar.

    Once you insert a macro into an RTE you need to be sure that the RTE is displayed in your template. You should have an <umbraco:Item field="blah" runat="server" /> tag in your template. The field alias should match the alias of your RTE. Then, whatever you put in the RTE will appear on your page, be it some text or a macro or both.

    cheers,
    doug.

Please Sign in or register to post replies

Write your reply to:

Draft