• 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 ?

Thibeault

Active member
#1
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
 

wang

Well-known member
#5
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}.