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

    How to make ditto truncate content automatically if introtext field is not empty ?

    I have 2 pages. One i want to display summary from introtext using [+introtext+] and another one i want to display summary from content truncation.

    [[Ditto? &parents=`22` &extenders=`summary` &dateSource=`createdon` &dateFormat=`%b %d %Y %I.%M %p` &display=`4` &paginate=`0` &truncLen=`1000` &truncText=`More...` &tpl=`ditto_news` &orderBy=`createdon DESC`]].

    By using [+summary+] it truncates very well, but if i fill introtext field, the ditto will display intro text instead of automatic truncate from content.

    Any work around ? I use EVO.

    Regards
      • 4872
      • 12 Posts
      Currently my work around is by hacking summary.extender.inc.php. I use truncLen parameter as the key. If i want introtext to display i set &truncLen = `0`, otherwise i set to real truncate length of the content.

      Small modification to the conditional statement.

      else if (strlen($resource['introtext']) > 0){ 
      $summary = $resource['introtext'];
      $this->link = '[~' . $resource['id'] . '~]';
      $this->summaryType = "introtext";
      $closeTags = false;
      }


      i change it to

      else if ($truncLen == 0){
      //and so on...
      }


      So everytime i set truncLen parameter greater than zero, it won’t give introtext anylonger.

      If you have any simple way would be great, so i dont have to worry if someday i replace ditto package accidentally.