简体   繁体   中英

How to limit content block in octobercms

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' %}

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM