Will not truncate

Permalink Browser Info Environment
Hi There,

I have your add-on working and it pulls through the first block in the main area. I need to truncate it to 200 chars or so. I have followed your instructions and selected custom template, and truncate afetr 200 xhars. I have cleared the cache but it pulls through the whole article.

Any ideas please..?

Thanks

Type: Discussion
Status: New
obaudains
View Replies:
jordanlev replied on at Permalink Reply
jordanlev
Truncation only works on "Content" blocks. Is it possible that you have other kinds of blocks on the page?
madesimplemedia replied on at Permalink Reply
madesimplemedia
Hi jordanlev

Is there a way of getting it working on another block, I have a Designer Content Pro block and need to get it to work on that.

Thanks
Dave
jordanlev replied on at Permalink Reply
jordanlev
Hi Dave,
You can use C5's built-in truncation function on any text... so in this case you can take the "teaser" and then run the truncation on that. For example, copy /packages/page_list_teasers/blocks/page_list/templates/teasers.php to /blocks/page_list/templates/teasers.php, then modify the new copy of that file and find this line:
$teaser = $plth->getPageTeaser($page, 'Main', $teaserBlockCount, $teaserTruncateChars);

...and directly below that line insert a new line:
$teaser = $th->shortenTextWord($teaser, 200);


If you need more fine-grained control over what block types get included in the teaser, let me know because there are other methods that are more complicated but are more flexible. (Also, if you're a customer of Designer Content Pro, you can submit a support request over on the marketplace page for that addon and I will respond much quicker since I don't check emails for these free addons as often as I do for the paid addons).

Hope that helps!

-Jordan

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.