Copied to clipboard

Flag this post as spam?

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


  • Steve 128 posts 306 karma points
    Nov 14, 2014 @ 19:31
    Steve
    0

    Access properties within RTE, in re-usable content section

    Hi,

    I've built a section of re-usable content by creating a folder outside of the site root containing document types which can be placed in other nodes using a Multinode Treepicker (inspiration was found in this forum topic)

    I've also found a way to access properties from within the RTE using a template and macro. (details here)

    However, when these two techniques are combined (placing property values in the RTE within one of the re-usable nodes) then end result is that the static content rendered within the RTE is rendered in the browser. The macro itself is not executed.

    I'd like users to be able to place a site wide variable within the RTE, but also have the parent document be re-usable throughout the site. Any suggestions would be greatly appreciated!

    Steve

  • Charles Afford 1163 posts 1709 karma points
    Nov 20, 2014 @ 23:27
    Charles Afford
    0

    Hi Steve,

    Are you just trying to render the macro on the page? Or do you need help actually creating the macro. IE passing the content picked to your script file? Charlie :)

  • Steve 128 posts 306 karma points
    Nov 21, 2014 @ 04:18
    Steve
    0

    Hi Charles,

    Yes, the difficulty was rendering the macro embedded in the template when it was stored in a 're-usable node' placed in a regular node using the MNTP.

    The macro embedded in the template rendered when placed in a regular content page, but is stored as literal text in the 're-usable nodes' placed on the content pages with the MNTP (the macro was rendered). 

    I found a solution:  a handler macro to parse the text string stored in the values placed using the MNTP (using the Html Agility Pack it looks for the 'snippet' class, removes the umbraco:macro text and then looks up the variable based on the innerhtml). Values which are re-used throughout the site can be stored in the root node, placed in the RTE and will be rendered using the template/macro combination in both regular and re-used nodes.

    If there is an easier way to do this I'd certainly be interested for future projects (as this turned into a complex solution to what seemed a simple task!)

    Thanks, Steve

  • Charles Afford 1163 posts 1709 karma points
    Nov 22, 2014 @ 11:29
    Charles Afford
    0

    Hi Steve.

    Sorry i am a bit confused about how this works?. Could you explain in very very simple non technical terms :).

    Parsing the XML that the macro generates to get the ID sounds wrong to me.

    What version of Umbraco are you using?

    Are you using MVC?

    Do you have a partial view macro with a parameter?#

    Thanks,

    Charlie.

  • Steve 128 posts 306 karma points
    Sep 27, 2015 @ 03:16
    Steve
    0

    Charlie, Been a long time but back working on this. I've updated the site to use partial view macros but still having difficulty getting the macro to render in parent macro (which is a .net usercontrol macro). I can't get the macro parameters to pass through when the macro is called from code. Any ideas welcome! Thanks, Steve

Please Sign in or register to post replies

Write your reply to:

Draft