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

Are there anyway to use <xen:form> and <xen:listitem> out of admin-cp?

Discussion in 'XenForo Development Discussions' started by timothy259856, Sep 12, 2014.

  1. timothy259856

    timothy259856 Active Member

    Hello guys, I wish to create a table which allow user manage their information, just like the table of admin-cp, for example: http://localhost/test/admin.php?add-ons/ this table very easy to use, it's contain filter...

    But when I try to use that style for normal template, it's said that:

    Unknown tag: listitem
    Unknown tag: form

    Thank guys!
  2. Mr. Goodie2Shoes

    Mr. Goodie2Shoes Well-Known Member

    No... because the compilers for xen:form and xen:listitem are only called during the compilation of admin templates.
    timothy259856 likes this.
  3. timothy259856

    timothy259856 Active Member

    Thank for your reply. Try to find another template to use :)
  4. Jeff Berry

    Jeff Berry Well-Known Member

    Actually, yes you can. I had the same need and came up with a quick work around that allows me to use admin tags in public templates.

    What you need to do is just create a temporary admin view renderer, and then you can render any admin template. Here is my code snippet:

    $viewRenderer = new XenForo_ViewRenderer_HtmlAdmin(

    $adminView = new XenForo_ViewAdmin_Base($viewRendererXenForo_Application::getFc()->getResponse());

    $rendererOptions $this->getRendererOptions();
    $rendererOptions XenForo_Model::create('XenForo_Model_Option')->prepareOptions($rendererOptions);

    $this->_element['renderedOptions'] = XenForo_ViewAdmin_Helper_Option::renderPreparedOptionsHtml($adminView$rendererOptionsfalse);
    This snippet allows me to use <xen:spinbox, <xen:textbox, <xen:radio, etc. outside of the admin panel. I'm not sure of your coding experience, but this probably takes some thorough understanding of how it works to get it to do what you want, but it can certainly be done. Don't ever accept no as an answer :) With PHP, anything you want to do is possible.
    timothy259856 likes this.
  5. timothy259856

    timothy259856 Active Member

    Thank for your solution, very good idea with render template, don't think about that ago :) I'll do a try in a other addon, at now, I'm just use simple layout. Thanks anyway :)
  6. timothy259856

    timothy259856 Active Member

    Hello Jeff, can you help me take a look at https://xenforo.com/community/threa...fter-receive-a-post-type-in-controller.82838/ ?

    Thank you!

Share This Page