Condado Braveheart
New member
Hi, there!
We're developing a portal to our forum. In this system, admins can create dynamically theirs columns using the XF template syntax or an existing template.
Here's a simple example:
Note: The Código field is saved to the database as a varchar.
When the system calls the columns to load on the page, using
At this point okay, because XF templates are rendered by a template data that was retrieved from the
I know that you can render a template on the backend using the
Is there a possibility to render template codes passing a string and the system parse it to a HTML content?
Example:
If it's not possible, is there a security reason that does not allow to do this?
We're using XF 2.2.4.
We're developing a portal to our forum. In this system, admins can create dynamically theirs columns using the XF template syntax or an existing template.
Here's a simple example:
Note: The Código field is saved to the database as a varchar.
Glossary (PT-BR to EN):
Conteúdo da Coluna = Column Content
Tipo de conteúdo = Content type
Código puro = Raw code
Código = Code
When the system calls the columns to load on the page, using
{$column.content_raw|raw}
, the result comes like this:At this point okay, because XF templates are rendered by a template data that was retrieved from the
xf_template
table (not considering the work done by template modifications, obviously) on the backend. So it cannot render the string.I know that you can render a template on the backend using the
renderTemplate()
method from the XF\Template\Templater
class, but you need to pass as an argument the template name. In this case, the raw code does not belong to any template, it's just a XF template code block that needs to be rendered to HTML.Is there a possibility to render template codes passing a string and the system parse it to a HTML content?
Example:
PHP:
$content = '<xf:avatar user="{$xf.visitor}" size="m" canonical="true" />';
$html = someFunctionToRenderTemplateCode($content); // Is this possible in XF?
If it's not possible, is there a security reason that does not allow to do this?
We're using XF 2.2.4.