1. 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

Discussion in 'XenForo Development Discussions' started by Tilkißey, Jan 3, 2011.

  1. Tilkißey

    Tilkißey Well-Known Member

    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?

  2. Shadab

    Shadab Well-Known Member

    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.
    Tilkißey likes this.
  3. Tilkißey

    Tilkißey Well-Known Member

    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)
  4. Shadab

    Shadab Well-Known Member

    Where exactly are you trying to include a template?
    The xen:include markup will only work when you are using it inside a template.
  5. Tilkißey

    Tilkißey Well-Known Member

    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:
  6. Shadab

    Shadab Well-Known Member

    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:
    $options XenForo_Application::get('options');
    $myTemplate $this->createTemplateObject($options->myCustomTemplateName)->render();

    $this->_params['myTemplate'] = $myTemplate;
    In your template:
    <!-- Now you can output the rendered template -->
    {xen:raw $myTemplate}
    Tilkißey likes this.
  7. Tilkißey

    Tilkißey Well-Known Member

    ok shadab, i see
    thanks for your helps :)
    Shadab likes this.

Share This Page