Copied to clipboard

Flag this post as spam?

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


  • mfeola 117 posts 221 karma points
    Jun 16, 2010 @ 18:47
    mfeola
    0

    Cannot display embedded macro within a rich text editor using c sharp

    I made a macro that displays all the content from another, specified, document type's children.  

    Everything worked fine until I tested whether you can include a macro in rich text editor and display it on the content display page. The inserted macro just gets skipped over in the page rendering.  Here is a simplified version of my display code if it helps ('maincontent' is the name of the rich text datatype in the document type):

    Document singleevent = new Document(this.eventID);
    System.Text.StringBuilder sb = new System.Text.StringBuilder();
    
    sb.Append("<div class=\"eventtext\">" + singleevent.getProperty("maincontent").Value.ToString() + "</div>");
    
    DisplayElement.Text = sb.ToString();  
    

    i guess maybe getProperty isn't the best way of display content? I will keep working on it and if I find a solution I will post it here.  As of right now I am kind of stumped

  • mfeola 117 posts 221 karma points
    Jun 16, 2010 @ 19:14
    mfeola
    0

    alright, i looked at the source and it looks like it actually is trying to render, but not the correct thing, this is what i got out of the page source (i am trying to insert a youtube macro, it works on other pages that display more traditionally):

     

    <?UMBRACO_MACRO
    youtubeurl="http://www.youtube.com/watch?v=WLB9MdmAl90"
    youtubewidth="480" macroAlias="YouTube"
    youtubealign="1" youtubeheight="385" /?>

    looks like it isn't translating the macro, any suggestions?

     

     

  • mfeola 117 posts 221 karma points
    Jun 16, 2010 @ 19:28
    mfeola
    0

    Tried this code but it actually stripped out the macro code entirely instead or display it:

    sb.Append("<div class=\"eventtext\">" + umbraco.library.RenderMacroContent(singleevent.getProperty("maincontent").Value.ToString(), umbraco.presentation.nodeFactory.Node.GetCurrent().Id) + "</div>");
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies