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

Use HTML at xenOptions + TextArea Option

Dr.Yontem

Formerly Tilkißey
#1
i ve a problem bout using html codes at xenOptions area

i am trying write an add-on and in this add-on we can enter text from ACP
i call it like that {$xenOptions.XXX} in a template
but, if i wanna see the results, there is no parsing html or bbcode
what can i do for using all codes?

and, another question about xenOptions area
i want to create textArea with more one lines (2,3,4,...., flexible)
is there anyway for do it?

thanks...
 

Shadab

Well-known member
#2
Any variable that you output using the {$var} syntax will be properly escaped. If you don't want XF to escape the value of your variable, use the {xen:raw $var} syntax.

PS: Use raw values only if you are absolutely sure that the value contains trusted content or has been escaped previously somewhere.
 

Dr.Yontem

Formerly Tilkißey
#3
Any variable that you output using the {$var} syntax will be properly escaped. If you don't want XF to escape the value of your variable, use the {xen:raw $var} syntax.

PS: Use raw values only if you are absolutely sure that the value contains trusted content or has been escaped previously somewhere.
thx for ur answer
i tried xen:raw method and succeded for HTML
but, i ve a problem still

how can i include a template?
an example, i will write in acp <xen:include template="node_list" /> (to a text box)
 

Shadab

Well-known member
#4
Where exactly are you trying to include a template?
The xen:include markup will only work when you are using it inside a template.
 

Dr.Yontem

Formerly Tilkißey
#5
Where exactly are you trying to include a template?
The xen:include markup will only work when you are using it inside a template.
i am working with an add-on and i want to that i can call any template from options area to another template

maybe i couldnt explain exactly =(
1-) i wrote an add-on
2-) opened acp options area
3-) there is textbox which called from a template (this template is setuped with add-on)
4-) i will fill this textbox with a template name
5-) this template will be called from add-on's template

sorry for my English :oops:
 

Shadab

Well-known member
#6
Ah. That's not possible, because template "includes" are resolved at compile time (ie, when you save a template). So if you want to dynamically include a template, you'll have to render it yourself.

In your View class:
PHP:
$options = XenForo_Application::get('options');
$myTemplate = $this->createTemplateObject($options->myCustomTemplateName)->render();

$this->_params['myTemplate'] = $myTemplate;
In your template:
HTML:
<!-- Now you can output the rendered template -->
{xen:raw $myTemplate}