MyBB Community Forums

Full Version: Adding PHP to templates using global.php
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I have an alternate suggestion to this. Put your html in the templates in MyBB, then extract that into the header.php & footer.php files. This way you just change it in MyBB and voila, it changes everywhere.

I've actually gone to basically empty php files and have all my html inside MyBB's template system. I've actually posted this elsewhere on the forum already.

Here's an example header.php:
<?php

define("IN_MYBB", 1);
define('THIS_SCRIPT', '../header.php');
require_once("mybb1.6/global.php");
global $headerinclude, $header, $mybb;

// Would be better to use MyBB's output_page() function, but then we'd have to actually *build* a page
echo $header;

?>
Thanks, G33k and Malcolm!

Would this have any performance impact versus just hardcoding the contents of masthead.php into the template?

Thanks,

Chris
Thanks to you too, Dylan. I didn't see your post before I replied.
(2011-03-30, 01:17 AM)Dylan M. Wrote: [ -> ]I have an alternate suggestion to this. Put your html in the templates in MyBB, then extract that into the header.php & footer.php files. This way you just change it in MyBB and voila, it changes everywhere.

I've actually gone to basically empty php files and have all my html inside MyBB's template system. I've actually posted this elsewhere on the forum already.

Here's an example header.php:
<?php

define("IN_MYBB", 1);
define('THIS_SCRIPT', '../header.php');
require_once("mybb1.6/global.php");
global $headerinclude, $header, $mybb;

// Would be better to use MyBB's output_page() function, but then we'd have to actually *build* a page
echo $header;

?>


it seems i'm having an issue with this code. and this plugin.
Can anybody assist
Pages: 1 2