How to parse a content with a hook ?

Thibeault

Active 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
 
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

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}.
 
Top Bottom