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

How to parse a content with a hook ?

Discussion in 'XenForo Development Discussions' started by Thibeault, Dec 31, 2015.

  1. Thibeault

    Thibeault Member

    Hello,

    I would like parse a content and display it in a template. But, i don't know how to do that with this code :
    Code:
     
      $content .= $template->create('template_name', $params);
    
    How to add a view ?

    Thank's,
    Thibeault
     
  2. Jake B.

    Jake B. Well-Known Member

    Template hooks are deprecated as of 1.2 iirc. Best to use a template modification :)
     
  3. Thibeault

    Thibeault Member

    It's not my question. ;)
     
  4. Thibeault

    Thibeault Member

  5. wang

    wang Well-Known Member

    Inside your function that will hook into template hooks, you can use something like this.

    PHP:
    if($hookName == 'hookName')
               {
                
    $varName 'code goes here that you want to parse';
                
    $myTemplate $template->create('template_name'$params);
                
    $myTemplate->setParam('varName'$varName);
                
    $contents .= $myTemplate;

            }
    With this code you create your custom template and you have registered the $varName variable that you can use in your template like this. {$varName}.
     

Share This Page