• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Nesting XenForo template syntax

#1
I am looking to display the contents of a post with a certain id on a page as achieved in this tutorial: https://xenforo.com/community/resources/how-to-show-a-post-in-a-page.306/

However I'd also like to trim the size of said contents. Including the post contents on a page via {xen:raw $post.messageParsed} works perfectly fine. However after having trimmed the contents using {xen:helper snippet, {xen:raw $post.messageParsed}, 165} the message is displayed as plain HTML (e.g. <i> and <br> tags are printed as is). Trying it the other way round {xen:raw {xen:helper snippet, $post.messageParsed, 165}} or {xen:raw ${xen:helper snippet, $post.messageParsed, 165}} gives me an error stating my syntax is invalid. But at this point I'm only guessing.

Is it possible to do this inside the page template at all or should I trim the contents before they're stored in $post.messageParsed?

Thank you.​
 

katsulynx

Well-known member
#2
You're best of trimming the content before you pass it to the template. Keep in mind that you might break syntax if you cut a closing tag however.