Truncate shows an "<" :(

Discussion in 'PHP' started by Midoriana, Jun 15, 2012.

  1. #1
    I am using the code below to only show some of the description of an article on another page, and below the shorter description I have a link that says "read more" where the visitor gets linked to the original page.

    However, on some of these shorter ones, using this code, an "<" shows up. Which isn't very nice looking. How can I stop that from showing up?

    Thank you.


    Code:
    <div>
    {{product.description | truncate 150 | safe }}
    </div>

    Gives:
    Lalala lalala lalala test test.Lalala lalala lalala test test.Test: Lalala lalala lalala test test.

    Test: Lalala lalala lalala test test. Test<...
     
    Midoriana, Jun 15, 2012 IP
  2. NetStar

    NetStar Notable Member

    Messages:
    2,471
    Likes Received:
    541
    Best Answers:
    21
    Trophy Points:
    245
    #2
    What does this have to do with PHP?

    Sounds to me like you are using some sort of templating system. It would help if you were actually specific.
     
    NetStar, Jun 15, 2012 IP
  3. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #3
    Sounds more like you have an extra "<" in your code somewhere (it happens to all of us at one time or 10 others). Remove it. (Finding it is your job.)
     
    Rukbat, Jun 15, 2012 IP