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 4448 posts 17913 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 567 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 182 posts 273 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 80 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 42 posts 254 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