Copied to clipboard

Flag this post as spam?

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


  • John Churchley 27 posts 172 karma points
    Mar 19, 2014 @ 23:28
    John Churchley
    0

    StripHtml and Truncate gone in V7?

    Anyone know if the StripHtml and Truncate methods have gone in V7?

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Mar 19, 2014 @ 23:56
    Dennis Aaen
    105

    Hi John,

    Here is an example how you could use StripHtml and Truncate methods in Umbraco 7.

    Truncate:

    @Umbraco.Truncate(CurrentPage.bodyText, 122)

    StripHtml

    @Umbraco.StripHtml(CurrentPage.bodyText)

    Hope this helps,

    /Dennis

  • John Churchley 27 posts 172 karma points
    Mar 20, 2014 @ 00:04
    John Churchley
    0

    Thanks Dennis!

  • Streety 358 posts 568 karma points
    May 15, 2014 @ 09:53
    Streety
    2

    yep the bible razor Node cheat sheet needs updating.

    So @library.Trancate is now @Umbraco.Truncate.

     

    And a few others.

  • Carlos Mosqueda 242 posts 433 karma points
    Oct 09, 2014 @ 17:53
    Carlos Mosqueda
    0

    So if there is a truncate in the middle of an IMG tag, would this still strip the HTML or would we need to put in exceptions for the IMG tags and such.

     

     

  • Thomas Higginbotham 4 posts 81 karma points
    Apr 17, 2019 @ 20:48
    Thomas Higginbotham
    7

    Seems to have changed again in Umbraco 8. They're now HTML helper extensions.

    @Umbraco.Truncate() is now @Html.Truncate()

  • Alan Mitchell 57 posts 281 karma points c-trib
    Jul 22, 2019 @ 13:01
    Alan Mitchell
    4

    For anyone else searching here for migrations of code to V8, it's a similar pattern for StripHtml. Looks like various text functions have moved from the bulging swiss army knife of UmbracoHelper into HtmlHelper, so

    Umbraco.StripHTML() 
    

    is now

    Html.StripHtml()
    
Please Sign in or register to post replies

Write your reply to:

Draft