This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

daft.pirate19542
daft.pirate19542

Hello.

I found this nice features in october docs:

{{ str_limit('The quick brown fox...', 100, '... Read more!') }}

{{ str_words('The quick brown fox...', 100, '... Read more!') }}

{{ html_limit('<p>Post content...</p>', 100, '... Read more!') }}

Both work great with content put into them directly - cut characters/words over 100 and add "... Read more!"

But how to make something similar with content loaded from plugin? For example -

{{ item.description }}

It can't work inside these functions, but they just made me realise I want to use something like that!

Thanks!

Last updated

Shantarli
Shantarli

I've found similar question here https://octobercms.com/forum/post/str-limit-in-component?page=1

Try this: {{ str_limit(item.description|raw , 100) }}

daft.pirate19542
daft.pirate19542

Oh, man! Thank you.

I tried multiple ways to write it, like author of that topic, but not the right one.

1-3 of 3

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.