Copied to clipboard

Flag this post as spam?

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


  • Dibs 202 posts 991 karma points
    Oct 16, 2015 @ 10:29
    Dibs
    0

    Macro RTE parameter displays html tags with content

    Dear Umbraco Forum

    I have created a macro with a custom RTE parameter, after adding text, images & links and saving. the rendered content displays html tags along with content.

    example i enter 'Hello World' and rendered RTE macro displays <p>Hello World</p>

    how can i display content without the html tags ?

    I would like to add the macro is used within a RTE property editor.

    Dibs

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Oct 16, 2015 @ 11:07
    Dennis Aaen
    100

    Hi Dibs,

    Display content without html tags you need to use the method called @Html.Raw() where you pass in the field or a variable.

    Like this:

    @Html.Raw(CurrentPage.ProperyAlias)
    

    You can find more information about this on Umbraco TV. http://umbraco.tv/videos/umbraco-v7/implementor/working-with-umbraco-data/razor-syntax/htmlraw/

    Hope this helps,

    /Dennis

  • Dibs 202 posts 991 karma points
    Oct 22, 2015 @ 13:35
    Dibs
    0

    Hi Dennis

    I have now created a grid layout template. When i add the same macro to the template, the <p> tag are being rendered when im using @Html.Raw(CurrentPage.ProperyAlias) code.

    Any advise ?

    Dibs

  • Dibs 202 posts 991 karma points
    Oct 16, 2015 @ 12:00
    Dibs
    0

    Cheers Dennis

    solved issue. lack of Razor knowledge on my part.

    Thnaks Dibs

  • Sebastian Pierre 5 posts 74 karma points
    May 13, 2016 @ 07:15
    Sebastian Pierre
    0

    My macro parameter RTE sent out tags even after Html.Raw was applied.

    I solved it by doing this

            var yourVariable= Model.MacroParameters["parameterName"].ToString();
    
            @Html.Raw(HttpUtility.HtmlDecode(yourVariable))
    

    Seb

Please Sign in or register to post replies

Write your reply to:

Draft