XF 2.2 Using snippet()

Lee

Well-known member
How would I go about making this code:

HTML:
<article class="message-body">
{{ bb_code($post.message, 'post', $post) }}
</article>

Limited to 500chars whilst retaining attachments and BBCode?

Thanks :)
 
HTML:
{{ bb_code_snippet($post.message, 'post', $post, 500) }}
Thanks!
Can I use options here?
<xf:set var="$messageBB" value="{{ bb_code_snippet($post.message, 'post', $post, $snippet, {'stripQuote': true}) }}" />
{{ $messageBB | raw}}

This shows the attachments (bbcode), but does not strip the quotes.
 
It supports BB code renderer options but those are different from string formatter options. You can likely nest snippet(...) with no max length to strip them though.
 
It supports BB code renderer options but those are different from string formatter options. You can likely nest snippet(...) with no max length to strip them though.
Thanks, Yes, I've tried that
HTML:
<xf:set var="$messageSnippet" value="{{ snippet($post.message, 0, {'stripQuote': true, 'stripHtml': true}) }}" />
<xf:set var="$messageBB" value="{{ bb_code_snippet($messageSnippet, 'post', $post, 85) }}" />
{{ $messageBB | raw }}

but then the images are not displayed.
 
I see, looking at the code stripQuote is a bit misleading as it also enables stripBbCode and stripPlainTag. I don't think there's a built-in way to strip only quotes.
 
Back
Top Bottom