Simple Machines Community Forum

Customizing SMF => Graphics and Templates => Topic started by: AugustBurnsRedQC on April 11, 2012, 12:00:09 PM

Title: integrate forum in a site that use template engine
Post by: AugustBurnsRedQC on April 11, 2012, 12:00:09 PM
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
Title: Re: integrate forum in a site that use template engine
Post by: Marcus Forsberg on April 13, 2012, 08:54:43 AM
How exactly are you trying to call the header in SMF's files? Can you post the code?
Title: Re: integrate forum in a site that use template engine
Post by: AugustBurnsRedQC on April 13, 2012, 11:28:30 AM
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?
Title: Re: integrate forum in a site that use template engine
Post by: Marcus Forsberg on April 13, 2012, 11:30:36 AM
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)?
Title: Re: integrate forum in a site that use template engine
Post by: AugustBurnsRedQC on April 13, 2012, 11:36:55 AM
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