Copied to clipboard

Flag this post as spam?

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


  • Fuji Kusaka 2203 posts 4220 karma points
    Mar 04, 2014 @ 17:26
    Fuji Kusaka
    0

    Truncate RTE is removing part of my Content

    Hi,

    Am having some very weird issues here where my content text in RTE is not displaying well when i try to truncate the content.

    Part of the content in my Rte has classes such as <h1 class="" >

    @Library.Truncate(@Library.StripHtml(content.GetProperty("bodytext").Value.ToString(), "p"), 250, false) // This jus removed part of my content 
    @content.bodytext // i get the full content without any issues

    Any idea what might be causing this ?

     

     

  • Fuji Kusaka 2203 posts 4220 karma points
    Mar 04, 2014 @ 17:35
    Fuji Kusaka
    0

    Weird when i try to truncate the content RTE i get this as output

    <h1 class="sub"></h1>

    and without the truncate

    <h1 class="sub">Title 1</h1>
  • Fuji Kusaka 2203 posts 4220 karma points
    Mar 21, 2014 @ 18:21
    Fuji Kusaka
    0

    Did solved this issue by just removing the <h1> Tag from my RTE . But anyone else had the same problem before, truncate doesnt work with <h1> tag or any <h1-<h6> tag.

     

    /fuji

  • Charles Afford 1163 posts 1709 karma points
    Mar 23, 2014 @ 20:45
    Charles Afford
    0

    Hi, What is rendered by @Library.StripHtml(content.GetProperty("bodytext").Value.ToString(),"p")?

    If its not that causing the problem then i guess its a bug or a parameter is missing or incorrect :). Charlie

  • Kasper Dyrvig 246 posts 379 karma points
    Mar 24, 2014 @ 15:45
    Kasper Dyrvig
    0

    It might me bacause you specify what html tag to strip. (in your code above you only strip p tags.) Then if your h1 tag plus content is longer than 250 charecters the h1 won't get a closing tag. And therefore the rest of your page is now a part of that h1 tag.

    But if you don't specify what tag to strip but just leave it at Library.StripHtml(Model.bodyText) all of the content will be striped and you are free to truncate it.

  • Fuji Kusaka 2203 posts 4220 karma points
    Mar 25, 2014 @ 04:03
    Fuji Kusaka
    0

    Hi Kasper,

    I did try Library.StripHtml(Model.bodyText) but this is not the issue, its only when i Truncate the bodyText that the content is not rendering well since i have html tag <h1 - h6>.

     

     

  • Kasper Dyrvig 246 posts 379 karma points
    Apr 01, 2014 @ 13:25
    Kasper Dyrvig
    0

    Have you checked what output you get in the final rendered HTML? In my mind and in my little local test the problem can most likely only happen if some tags are not closed correctly.

    Like...

    <h1>Headline text [truncate happens]...

    But if the HTML is striped completly:

    Headline text...
Please Sign in or register to post replies

Write your reply to:

Draft