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

    Has anyone managed to succesfully truncate the contents of either a) the introtext (summary) field or b) the main content field?

    I have been though all documentation and nothing seems to work, I have the following Ditto call:

    [[Ditto?startID=`15` &tpl=`NewsDittoTemplate` &orderBy=`publishedon ASC` &paginate=`1` &summarize=`3` &paginateAlwaysShowLinks=`1`  &truncLen=`50` &extenders=`summary` &truncOffset=`1` ]]


    Which lists the contents of container ID 15, with a template called NewsDittoTemplate ordered in Acending order by publishdate with pagintation in effect showing 3 items on each page, attempting to truncate to 50 characters with an offset of 1....

    This does not truncate either the content of my introtext(summary) content field or content field from each of the documents its listing...


    Any help greatly recieved! P.S. I am running MODx 0.9.6.3 with Ditto 2.1
      • 8168
      • 1,118 Posts
      P.s. Template code is:
      <h3><a href="[~[+id+]~]" title="Read more about [+pagetitle+]">[+pagetitle+]</a></h3>
      <p>[+pub_date:date=`%d %B %Y`+]</p>
      <p>[+introtext+]</p>
      <p><a href="[~[+id+]~]" title="Read more about [+pagetitle+]">Find out more...</a></p>
      <div class="hrNarrow"><hr /></div>


      I want the contents of
      <p>[+introtext+]</p>
      to be truncated....
        • 8168
        • 1,118 Posts
        P.S. For those reading this having the same problems, seems this is the eaiest way of solving the issue! http://wiki.modxcms.com/index.php/PHx/CustomModifiers#phx:character_limit
          • 26931
          • 2,314 Posts
          did you try [+summary+] in your Ditto Template to retrieve the truncated version of the content (or introtext) field?
          -> http://www.pogwatch.com/ditto/ditto-extenders/ditto-summary.html
            • 8168
            • 1,118 Posts
            Quote from: sharkbait at Jan 15, 2010, 12:58 PM

            did you try [+summary+] in your Ditto Template to retrieve the truncated version of the content (or introtext) field?
            -> http://www.pogwatch.com/ditto/ditto-extenders/ditto-summary.html

            Yeh - did nothing... no idea why!
              • 26931
              • 2,314 Posts
              is it outputting anything at all?

              btw. don’t know if it’s making any differnence, still worth trying:
              &summarize &startID are now deprecated
              &summarize has become &display and &startID <=> &parents(to fetch folders) or &documents(If you want specific ids)
                • 26931
                • 2,314 Posts
                just checked your call & template on an 0.9.6.3 installation

                [+summary+] instead of [+introtext+] in the template works as expected and truncates the [*content*] field if the summary field is left empty...and yeah, [+pub_date:date=`%d %B %Y`+] throws a wrong date
                  • 26931
                  • 2,314 Posts
                  for the date...

                  use
                  &dateSource=`pub_date` &dateFormat=`%d %B %Y`
                  in your Ditto call, then replace [+pub_date:date=`%d %B %Y`+] with [+date+] in your Ditto Template
                    • 8168
                    • 1,118 Posts
                    Thanks Sharkbait! You help is very greatly received!