We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 42213
    • 3 Posts
    Hello, first of all: I'm using MODx 2.2.5-pl on my site. I'm using the Richtext-TV "Eventbeschreibung" to display some custom text. After 254 characters it should be cropped and the string "..." has to be displayed after that. Right now my code looks like this.

    <div class="eventbeschreibungwrapper">
       <h1>[[+tv.Eventname]]</h1>
       [[+tv.Eventbeschreibung:limit=`254`]]...
       <a class="my-button[[+idx]]">mehr info</a>
    </div>
    



    Now, when Input-Text of the Eventbeschreibung-TV is longer than 254 chars, MODx produces the following output:

    <div class="eventbeschreibungwrapper">
       <h1>Rhythmusraum Eröffnung</h1>
       <p>Tag der offenen Tür zur Eröffnung des neuen Rhythmuszentrums! Von 13 bis 18 Uhr in der Barbarossastraße 64, in Kaiserslautern. Mit 15 minütigen gratis Mini-Workshops jeweils zur vollen Stunde, musikalischen Kostproben und einer Trommel- und Rhythmuspe...
          <a class="my-button1">mehr info</a>
       </p>
    </div>
    


    When the text is shorter than 254 chars, it produces this outpout:
    <div class="eventbeschreibungwrapper">
       <h1>Schnuppern für Anfängerkurse</h1>
       <p>Schnupperabend für Einsteiger oder Wiedereinsteiger: Trommeln, Body- und Vocal-Percussion, Songs, Rhythmus. Trommeln werden gestellt.
       </p>...
       <a class="my-button3">mehr info</a>
    </div>
    



    I dont really understand that behaviour. Why does that different number of characters change the Placement of the <p>-Tag?
    The Richtext-TV puts <p>-Tags around the text, but why is the anchor-Tag also inside the paragraph, when there are more than 254 chars?

    You can have a look at the site: http://rhythm-moves.de/events/ too see it live.
    Help is very appreciated.

    Thanks!

    This question has been answered by Bruno17. See the first response.

    • discuss.answer
      • 4172
      • 5,888 Posts
      I think this missing, closing </p> -tag is added client-side by your browser, not server-side by modx.

      Try to use
      [[+tv.Eventbeschreibung:striptags:limit=`254`]]


        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 42213
        • 3 Posts
        Excellent, this did the trick, thank you very much.
        Is there an easy way to show the "..." only when it's actually cropped?

        Please excuse my newbish questions, it's my first modx-site. smiley

        Right now i have
        <div class="eventbeschreibungwrapper">
        	<h1>[[+tv.Eventname]]</h1>
        	<p>[[+tv.Eventbeschreibung:striptags:limit=`254`]]...
        		<a class="my-button[[+idx]]">mehr info</a>
        	</p>
        </div>
        
          • 4172
          • 5,888 Posts
          you can try

          [[+tv.Eventbeschreibung:ellipsis=`254`]]


          http://rtfm.modx.com/display/revolution20/Input+and+Output+Filters+%28Output+Modifiers%29#InputandOutputFilters%28OutputModifiers%29-Stringoutputmodifiers
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 42213
            • 3 Posts
            That works nicely. You're the man!