MyBB Community Forums
[How To?] Include header and footer on other pages. - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Community Archive (https://community.mybb.com/forum-106.html)
+--- Forum: Archived Forums (https://community.mybb.com/forum-143.html)
+---- Forum: Archived Development and Support (https://community.mybb.com/forum-155.html)
+----- Forum: MyBB 1.6 (https://community.mybb.com/forum-138.html)
+------ Forum: 1.6 General Support (https://community.mybb.com/forum-127.html)
+------ Thread: [How To?] Include header and footer on other pages. (/thread-100986.html)

Pages: 1 2


Include header and footer on other pages. - Dead Soul™ - 2011-08-06

Is it possible to indclude header and footer template on custom pages which is not located the same place as MyBB-Forum. But placed at MyBB-Forum/Subfolder


RE: Include header and footer on other pages. - ranjani - 2011-08-06

if you are referring to php custom files then that should be possible by using the header & footer templates !!


RE: Include header and footer on other pages. - Dead Soul™ - 2011-08-07

But how to do it?


RE: Include header and footer on other pages. - ranjani - 2011-08-07

you can make a global template with required header part & another with required footer part
<?php
define("IN_MYBB", 1);
require_once ('/global.php');
eval("\$header1 = \"".$templates->get("customheader")."\";");
echo $header1;

required other content

eval("\$footer1 = \"".$templates->get("customfooter")."\";");
echo $footer1;
?>

OR use a plugin like page-manager


RE: Include header and footer on other pages. - Dead Soul™ - 2011-08-07

I tried to put that into the page.

But when I do that it only comes out with an error.

I think that the code you gave me is only working if the page is at the same folder as MyBB.
But my page is at a subfolder of my MyBB folder.


RE: Include header and footer on other pages. - ranjani - 2011-08-07

^ please check the path of global.php OR lets wait for an expert's guidance Smile


RE: Include header and footer on other pages. - Dead Soul™ - 2011-08-07

I have also tried this. But without any luck.

<?php
define("IN_MYBB", 1);
require_once ('../global.php');
eval("\$header1 = \"".$templates->get("customheader")."\";");
echo $header1;

required other content

eval("\$footer1 = \"".$templates->get("customfooter")."\";");
echo $footer1;
?>



RE: Include header and footer on other pages. - ranjani - 2011-08-07

^ what is the error you are getting ...


RE: Include header and footer on other pages. - Dead Soul™ - 2011-08-07

I am getting this error

Parse error: syntax error, unexpected '<' in /home/user/domain.com/folder/index.php on line 8

After putting the code in again I got this error instead.

Parse error: syntax error, unexpected T_STRING in /home/user/domain.com/folder/index.php on line 7



RE: Include header and footer on other pages. - faviouz - 2011-08-07

So you were using the exact same code ranjani posted? It was just an example...