We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28513
    • 53 Posts
    Hello, I am tring to show news on a homepage and want to limit the characters. I have read about using either [+summary+] or [+introtext+] and am not sure which to use. I have tried and neither seem to work.

    Here is where I call ditto:
    [[Ditto? &parents=`49` &tpl=`ditto.title.date.description` &dateFormat=`%b %d, %Y` &display=`3` &dateSource=`pub_date` &orderBy=`pub_date DESC` &trunc=`1` &truncLen=`219` &truncText=`...read more` ]]


    and here is my template chunk:
    <div class="item">
          <div class="date">
             [+date+]
              <strong>15</strong>
              <em>mar</em>
         </div>
         <div class="description">
              <h4><a href="[~[+id+]~]">[+pagetitle+]</a></h4>
              <p> [+summary+][+link+]</p>
         </div>
    </div>


    If I replace summary with content, I get the full text, but when I put summary or intro text I do not get anything.

    I also have one other question regarding this, as you can see here:
    <div class="date">
             [+date+]
              <strong>15</strong>
              <em>mar</em>
         </div>


    I am wanting to put the day in strong, and the month in em. How can I split up +date+ like that?

    Thanks for all the help!
      • 25132
      • 129 Posts
      I’d repost in the Ditto thread. You might get a faster response there smiley

      http://modxcms.com/forums/index.php/board,180.0.html
        • 28513
        • 53 Posts
        Thanks, I have posted over there. I tried to remove this post but it said I can not remove my own post?
          • 25132
          • 129 Posts
          If you go into your own profile details from the top-left of the MODx Forum page (Hello steve.mullen), you can view all of your posts and should be able to delete from there. Hope that works and that you find your answer. Sorry that I can’t help more sad
            • 20413
            • 2,877 Posts
            You could use PHx modifiers
            http://modxcms.com/forums/index.php/topic,34709.msg210786.html#msg210786

            And you can customise the date in the snippet call &dateFormat=`<strong>%b</strong> %d, %Y`
              @hawproductions | http://mrhaw.com/

              Infograph: MODX Advanced Install in 7 steps:
              http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

              Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
              http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
              • 26016
              • 561 Posts
              Along with those good date ideas, if you’re going to use &trunc and its relatives, I believe you’ll need this in your call, too, to make [+summary+] work properly, as it’s deprecated:

              &extenders=`summary`


              If you’re getting unpredictable results, read about the "wandering" stuff here. It apparently tries to truncate at a sensible spot, thus overriding an exact number.
              http://ditto.modxcms.com/extenders/summary.html

              Cheers, Dave
                MODx and Wordpress development
                Linux, PHP 5.2, MySQL 5.0, Evo 1.05, Revo 2.08-pl, Firefox 4
                • 28513
                • 53 Posts
                Great, thanks for the replies. I got it to work properly with the PHx plugin, but there is another problem, it is pulling [*content*] from homepage instead of the post. The title and date are correct, but the content is not.

                Here is my ditto call:
                [[Ditto? &parents=`49` &tpl=`ditto.title.date.description` &dateFormat=`<strong>%d</strong> <em>%b</em> ` &display=`3` &dateSource=`pub_date` &orderBy=`pub_date DESC` &extenders=`summary` &truncText=`read more` ]]


                And template chunk:
                <div class="item">
                      <div class="date">
                         [+date+]
                     </div>
                     <div class="description">
                          <h4><a href="[~[+id+]~]">[+pagetitle+]</a></h4>
                          <p> [*content:len:gt=`219`:then=`[*content:character_limit=`219`*]`:else=`[*content*]`*][+link+]</p>
                     </div>
                </div>
                


                Any ideas why the homepage content would be showing and not the news post’s content?

                Thanks.
                  • 4310
                  • 2,310 Posts
                  [*content*] is the current page
                  [+content+] is a placeholder for the content of the gathered pages from Ditto, so ...
                  [+content:len:gt=`219`:then=`[+content:character_limit=`219`+]`:else=`[+content+]`*][+link+]
                    • 28513
                    • 53 Posts
                    Got it, thanks!