We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25483
    • 741 Posts
    ronaldlokers Reply #1, 19 years ago
    I am using ditto to display products with multiple text-areas (I use tv’s for this) and I need to trunc these tv’s.

    How can I trunc a template variable that is used within a ditto template?
      with regards,

      Ronald Lokers
      'Front-end developer' @ h2o Media

      • 11975
      • 2,542 Posts
      Hi,

      you can use the limit phx modifier in you ditto tpl

      [+tvToTrunk:length:gt=`75`:limit=`75`+]

      :-)

      =>http://wiki.modxcms.com/index.php/PHx#length_.7C_len

        Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
        • 25483
        • 741 Posts
        ronaldlokers Reply #3, 19 years ago
        Thanks, that works laugh

        I now use this:

        [+opmerkingen:length:gt=`200`:then=`[+opmerkingen:limit=`200`+]{{ditto_leesmeer}}`:else=`[+opmerkingen+]`+]

        It truncates the text and shows a "read more" link when needed, else it just show the full text
          with regards,

          Ronald Lokers
          'Front-end developer' @ h2o Media

          • 7155
          • 160 Posts
          old post but very helpful right now!!!