We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

trunchtml not outputting the "..."

Development and Programming

michaelTSCPL's avatar
michaelTSCPL
105 posts
17 years ago
michaelTSCPL's avatar michaelTSCPL

I am using the trunchtml plugin which does a great job in preventing my template from breaking. I am however having issues with it not outputting the …

Here is the code I am using:

{exp:trunchtml chars="200" ending="<a href='{comment_url_title_auto_path}'>continue reading</a>" inline="..."}
{summary}
{/exp:trunchtml}

Am I missing something?

Moderator’s note: Moved to the Plugin subforums.

       
Sue Crocker's avatar
Sue Crocker
26,054 posts
17 years ago
Sue Crocker's avatar Sue Crocker

No, I suspect it’s a bug.. the same thing happens to me. You may want to contact the author of the plugin, or I can move this post to the Plugins forum.

       
Meirion's avatar
Meirion
127 posts
17 years ago
Meirion's avatar Meirion

Like you, I like this plugin, but find it lacking the elipsis.

It can be fixed with a little hack.

in pi.trunchtml find:

if ($exact != "yes") {
              $spacepos = strrpos($truncate, ' ');
              if ( $spacepos !== FALSE ) {
                  $truncate = substr($truncate, 0, $spacepos);
              }
          }
          
          foreach ($open_tags as $tag) {
              $truncate .= '</' . $tag . '>';
          }
          $truncate .= " " . $ending;
          $this->return_data = $truncate;

and change to:

if ($exact != "yes") {
              $spacepos = strrpos($truncate, ' ');
              if ( $spacepos !== FALSE ) {
                  $truncate = substr($truncate, 0, $spacepos);
              }
          }
          
          // add "..." at the end
          $truncate .= "...";
          
          foreach ($open_tags as $tag) {
              $truncate .= '</' . $tag . '>';
          }
          $truncate .= " " . $ending;
          $this->return_data = $truncate;
       
michaelTSCPL's avatar
michaelTSCPL
105 posts
17 years ago
michaelTSCPL's avatar michaelTSCPL

Thats great! I will make the change. Thanks for posting this “hack”.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.