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

trying to render template's to none xenforo page

Discussion in 'XenForo Development Discussions' started by Wuebit, Mar 14, 2011.

  1. Wuebit

    Wuebit Well-Known Member

    So after read all the awesome post that shadab has done this is what ive come up with so far

    $fileDir '/home/animelon/public_html';

    $fileDir '/library/XenForo/Autoloader.php');
    XenForo_Autoloader::getInstance()->setupAutoloader($fileDir '/library');

    XenForo_Application::initialize($fileDir '/library'$fileDir);

    // Not required if you are not using any of the preloaded data
    $dependencies = new XenForo_Dependencies_Public();


    # Rendering a template

    $request = new Zend_Controller_Request_Http();
    $response = new Zend_Controller_Response_Http();

    $viewRenderer $dependencies->getViewRenderer($response'Html'$request);

    // Now that you have an html view renderer, you can use it to render any view/template

    $viewParams = array(
    'var1' => 'Value 1',
    'var2' => 'Value 2',

    $content $viewRenderer->renderView(''$viewParams'');
    This is just in it's own php file for now testing to see if it works and ive done it right

    So am guessing the template name will need to go in here

    $content $viewRenderer->renderView(''$viewParams'HERE');
    Am still confused on how I can get the whole header tho, Will I need to add tons of templates to make this work?

  2. Luke F

    Luke F Well-Known Member

  3. Wuebit

    Wuebit Well-Known Member

    Thanks Dark I was planing on adding all my header on to my booru (shimmie)
    this is not the same thing tho right? this is for a custom single page? or am I reading that wrong, Because if this will work for that I love you so much lol <3
  4. Luke F

    Luke F Well-Known Member

    Oh right yeah, that's slightly different. Here's some disjointed code I wrote for Tapatalk that might help you:

        $derpView = new XenForo_ViewPublic_Base(
    XenForo_ViewRenderer_HtmlPublic($this->_dependencies, new Zend_Controller_Response_Http(), $this->_request), 

    $template $derpView->createTemplateObject('template_name', array(
    'param' => $param
    $html $template->render();
    A combination of the addon I posted and/or the code you posted and that should get you rendering templates.
  5. Wuebit

    Wuebit Well-Known Member

    Hmm if only I knew what you mean lol (y)
    Ill keep playing and see what I get, tho am not sure how to combine them :coffee:
  6. Wuebit

    Wuebit Well-Known Member

    So far using the code I posted at the start I have this (this is just the user_bar template)

    It's a start :D

    Tho I am unsure on what to do next >.>
  7. Claiver

    Claiver Member

    Did you ever succeed @Xencored ? :)
  8. Wuebit

    Wuebit Well-Known Member

    No mate :)

Share This Page