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

Adding template parameters via a template-hook

Discussion in 'XenForo Development Discussions' started by -Ice-, Jun 21, 2012.

  1. -Ice-

    -Ice- Active Member

    I was wondering if it's possible to add template parameters via a template hook listener function.

    This hangs forever (inside the template hook listener):
    PHP:
    $template->setParam("stream_num"5);
    $templateNew $template->create('ice_livestream_forumdisplay'$template->getParams());
    $contents $templateNew->render();
    The hook is in the same template as the template I want to add the parameters to, is this a problem?

    Thanks in advance :)

    Edit: Just realized I was going about this wrong. I now have just the <xen:hook> in the "forum_list" template, without a <xen:include> :oops: This works:
    PHP:
    if($hookName == 'ice_livestreams_display'){
        
    $newParams = array("stream_num"=> 5);
        
    $template->setParams($newParams);
        
    $templateNew $template->create('ice_livestream_forumdisplay'$template->getParams());
        
    $contents .= $templateNew->render();
    }
    Sorry :sick:
     

Share This Page