We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21417
    • 486 Posts
    awesome - you sound very clever thehen!!

    thanks so much.
      Web design Adelaide
      http://gocreate.com.au
      • 26931
      • 2,314 Posts
      I am wanting to use Ditto to display the first 3 paragraphs of news items on a site I am building but am not sure how to limit it to paragraphs only.
      this PHX modifier will return the first three paragraphs:
      -> create a new snippet and call it "phx:threep" with the content of:
      <?php
      $strpara = explode( '</p>', $output );
      $output = "<p>".strip_tags( $strpara[0] )."</p>"."\n";
      $output .= "<p>".strip_tags( $strpara[1] )."</p>"."\n";
      $output .= "<p>".strip_tags( $strpara[2] )."</p>";
      return $output;
      ?>

      in your Ditto Template-Chunk use it like this: [+content:threep+] ... ( or [+summary:threep+] )
        • 21417
        • 486 Posts
        Wow - thanks a million Sharkbait - that is perfect!!!

        Exactly what I was hoping to achieve.

        Thanks so much.

        You are brilliant Sharkbait!

        grin laugh wink

        For those (like me) who had never used phx before....

        Create a new snippet and call it "phx:threep":
        <?php
        $strpara = explode( '</p>', $output );
        $output = "<p>".strip_tags( $strpara[0] )."</p>"."\n";
        $output .= "<p>".strip_tags( $strpara[1] )."</p>"."\n";
        $output .= "<p>".strip_tags( $strpara[2] )."</p>";
        return $output;
        ?>


        Ditto Call (where startID represents the parent of the documents you’d like to summarise):
        [[Ditto? &startID=`40` &tpl=`3Para`]]


        Ditto template (I called it 3para):
        <div class="news">
         <h2><a href="[~[+id+]~]" title="[+longtitle+]">[+title+]</a></h2>
        [+content:threep+]
         <a href="[~[+id+]~]" title="Read the whole story" class="more">More...</a>
        </div>
        


        (using [+content:threep+] takes the first 3 paras from the resource content area)

        Enjoy.
          Web design Adelaide
          http://gocreate.com.au