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!
      • 16544
      • 86 Posts
      Because this is an old post I guess you already figure out. If you don’t, &truncLen will do it. I’m a MODx apprentice but I can tell you that &trunc and &truncText don’t get along. I had the same problem, when I added &trunc, &truncText=`...read more` disappeared.

      About [+date+], you can use instead createdon:date, something like this:
      <h2><a href="[~[+id+]~]">[+title+]</a></h2>
      <div class="date-wrapper">
          <span class="month">[+createdon:date=`%b`+].</span>
          <span class="day">[+createdon:date=`%d`+]</span>
      </div>
      [+summary+]
      <div class="read-more">[+link+]</div>
      </div>
      I hope it helps you or someone else. grin
        I had fainted, unless I had believed to see the goodness of the LORD in the land of the living.