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

    I am using ditto to display a summary of the content of news item on a page.

    The Ditto call is working but I want to limit the [+summary+] content to the first 3 paragraphs (rather than a character (as is the case now) or word limit).

    In other words, I want [+summary+] to display the entire content in the first 3 paragraphs for each news item (eg after 3 </p> tags in the [content] area).

    The news item are in their very own template called "3 column - news".

    Any ideas on how to achieve this dynamically?

    I have previously posted here but believe this is beyond just ditto now - and need help from a guru!

    (http://modxcms.com/forums/index.php/topic,35652.0.html)

    In the replies there was mention of a phx statement (or equivalent) for limiting the number of paragraphs or creating a plugin to add <!--splitter--> after the 3rd instance of the </p> by using regex but I am not sure what this means or how to achieve it (I am not a programmer)

    My current ditto call looks like this:

    [[Ditto? &startID=`49` &parents=`49` &truncLen=`400` &tpl=`intranet-news` &tplFirst=`intranet-news-first` &paginate=`1` &extenders=`summary,dateFilter` &paginateAlwaysShowLinks=`1` &orderBy=`newsDate DESC` &tagData=`summary`]] 


    I would be ever so grateful for any assistance.

    Thank you kindly.
      Web design Adelaide
      http://gocreate.com.au
      • 21417
      • 486 Posts
      For the time being I have solved this using a template variable called "newsSummary" which I manually copy and paste the first couple of paragraphs into.

      The ditto call is now:
      [[Ditto? &startID=`49` &parents=`49` &tpl=`intranet-news` &tplFirst=`intranet-news-first` &paginate=`1` &extenders=`summary,dateFilter` &paginateAlwaysShowLinks=`1` &orderBy=`createdon DESC` &tagData=`summary`]] 
      


      The template is now:

      <div class="news">
       <h2><a href="[~[+id+]~]" title="[+longtitle+]">[+title+]</a></h2>
       <p>[+newsDate+]</p>
       [+newsSummary+]
       <a href="[~[+id+]~]" title="Read the whole story" class="more">More...</a></p>
      </p> 
      </div>


      My preference is still for a dynamic option so if anyone comes up with an amazing idea to make it happen dynamically, I would love to hear from you.

      Thanks again.
        Web design Adelaide
        http://gocreate.com.au