Copied to clipboard

Flag this post as spam?

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


  • Georg Jung 11 posts 80 karma points
    May 27, 2014 @ 12:39
    Georg Jung
    0

    Create server script which mirrors document contents

    I'm working on an umbraco 6 project which has a lot of duplicate documents. I need multiple documents in my navigation structure which have the same content but a different title and a different position in the navigation tree. I created a documenttype with the generic property "copypage" (Type ContentPicker) where the editor can set which page's content should be mirrored. My current solution for this looks like

    var page = Library.NodeById(Model.copypage);
    @page.contents;

    but this leads to problems with macros contained in the mirrored page.

  • Jeavon Leopold 3072 posts 13628 karma points MVP 10x admin c-trib
    May 31, 2014 @ 07:50
    Jeavon Leopold
    0

    Is the problem that macros don't get rendered?

  • Jeavon Leopold 3072 posts 13628 karma points MVP 10x admin c-trib
    May 31, 2014 @ 07:53
    Jeavon Leopold
    0

    Assuming that to be the case, you can try

     @Html.Raw(umbraco.library.RenderMacroContent(page.contents.ToString(), Model.Id))
    
  • Georg Jung 11 posts 80 karma points
    Jun 03, 2014 @ 13:02
    Georg Jung
    0

    Thank you for your fast answer. Indeed my macros get rendered. Your line of code results in the same browser output as mine. My problem is that the macros get moved to the bottom of the page on the copied page:

    Original Copy
    Content Content
    Macroblock Content
    Content Macroblock
    Macroblock Macroblock

     

    Edit: Sorry, I misunderstood my problem a little bit myself. My macros on the original page access children of their document in the tree. I do not want to copy those children to the mirrored page. So my target is to execute the macros "in the context" of the original document, so that they see the children of the original document.

  • Jeavon Leopold 3072 posts 13628 karma points MVP 10x admin c-trib
    Jun 04, 2014 @ 10:26
    Jeavon Leopold
    0

    Ah ok,

    How about this then

    @Html.Raw(umbraco.library.RenderMacroContent(page.contents.ToString(), Model.copypage))
    
Please Sign in or register to post replies

Write your reply to:

Draft