Ad

How To Limit Content Block In Octobercms

- 1 answer

I have a content block {% content 'filename.htm' %} that I display on different pages of the website, however in some parts I want to display only a limited part of the content block.

How do I limit the content block? Is there a way to use str_words() or html_limit() with it {% content 'filename.htm' %}

Ad

Answer

Assign the results of the content block to a variable and then use an appropriate filter / function.

{% set content %}
    {% content 'filename.htm' %}
{% endset %}

{{ html_limit(content, 100) }}

See also https://octobercms.com/docs/markup/function-html

Ad
source: stackoverflow.com
Ad