News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

integrate forum in a site that use template engine

Started by AugustBurnsRedQC, April 11, 2012, 12:00:09 PM

Previous topic - Next topic

AugustBurnsRedQC

Hi, I would like to integrate my forum in my site web to have my header in the top of of page. I red some tutorial like those two: http://www.simplemachines.org/community/index.php?topic=145838.0 and http://www.simplemachines.org/community/index.php?topic=19638.0

but i can't make it work. I think the problem is that i'm using Savant3 as a template engine on my site. I have nav.inc.php that fetch header.tpl.php and footer.tpl.php. In all my tpl page i do: echo $this->header to have the header. But i can't make this work with smf.

Thanks for your help

Marcus Forsberg

How exactly are you trying to call the header in SMF's files? Can you post the code?

AugustBurnsRedQC

in index.template.php i write: require_once("../inc/nav.inc.php"); and in the body: echo $this->header;

but i get:

Using $this when not in object context in C:\wamp\www\perso\forum\Sources\Load.php(2151) : eval()'d code on line 187

and if i try: require_once("../templates/header.tpl.php"); instead of echo $this->header;

i get the same probleme because i use some echo $this->.... in the template


So the only way would be to do an other header just for the forum without using the template engine?

Marcus Forsberg

That's because $this can't be used just like that when it's not inside the object. What exactly does nav.inc.php look like (attach)?

AugustBurnsRedQC

#4
nav.inc.php is where i require all the script that i need in my site, some code with Session and:

$tpl->header = $tpl->fetch("header.tpl.php");
$tpl->footer = $tpl->fetch("footer.tpl.php");

edit: well look like that the only way would be to 'require_once' each part of the header and add a $level with '../' to the each path to be able to load all the file

Advertisement: