We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36695
    • 47 Posts
    Hi,

    There seems to be lots of posts and problems about [+summary+], but none of them address my problem! I want to truncate the summary to a particular length. I have included the `summary` extender, and set truncLen to 95. It is still not truncating anything!

    Here is my ditto call (tried it both cached and uncached just in case, with and without `truncSplit`):

    [!Ditto? &depth=`0` &parents=`0` &filter=`ShowOnHomepage,1` &tpl=`hpItem` &hiddenFields=`articleauthor` &dateFormat=`%B %Y` &extenders=`summary` &trunc=`1` &truncSplit=`0` &truncLen=`95` !]


    Here is my template:

    <div class="hp_item"> 
    <h3 class="hp_itemtitle"><a href="[~[+id+]~]" title="[+pagetitle+]">[+pagetitle+]</a></h3>
    <div class="hp_documentInfo">by <strong>[+articleauthor+]</strong> in [+date+]</div>
    <div class="hp_introtext"><a href="[~[+id+]~]" title="[+pagetitle+]">[+summary+]</a> <span class="readMoreLink">[+link+]</span></div>
    </div>


    Thanks for any help!
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      When I did that a while ago, I used phx to cut the string to the size I wanted.

      limit(=`length`)
      Returns the first X characters from the current value.
      Default: 100 characters.
      http://wiki.modxcms.com/index.php/PHx
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 36695
        • 47 Posts
        Thanks a lot - I’ll look into doing it that way.
          • 18397
          • 3,250 Posts
          Give the development version of Ditto a try as the summary extender included includes several fixes.
            • 17950
            • 1 Posts
            Quote from: Mark at Feb 09, 2008, 11:58 PM

            Give the development version of Ditto a try as the summary extender included includes several fixes.

            Can you give a short example of how to do this with Ditto 2.1.0? I’m having all kinds of trouble limiting the summary to ~100 characters.
              • 25373
              • 13 Posts
              Hello,

              this is relevant to my interests.

              i am totally confused about the &truncLen parameter.
              Can somebody explain how this works?

              thanks
              Alex
                • 16278
                • 928 Posts
                &truncLen is the starting point for Ditto’s calculation of where to cut off the main body text of your post to produce a summary for page containing the Ditto call. The number of characters stated in the parameter is adjusted to create valid HTML on a word boundary. The default length is 300 according to the official documentation, but it is actually 200 as far as I can see from the extender’s code.

                See http://www.pogwatch.com/ditto/ditto-extenders/ditto-summary.html for a description of the summarizing options in Ditto.
                smiley KP