MyBB Community Forums

Full Version: [PHP] include header and footer
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have 2 php files, header.php and footer.php in the /inc/ folder, and I was wondering if there was a way for me to make them appear at the top and bottom of every page. (header.php at top, footer.php at bottom).

I would think it has to do with the theme, so im using GRAYceful, can anybody help me?
y u need to include php headers? they do speacial jobs or only showing some things?
you may interest to use plugins or edit templates for both of abov monteined jobs.
regs
imei
There are three ways to do this.
PHP has a setting called something like 'pre_append_file'. This will attach a file to the beginning of every PHP file you call. I'm not exactly sure what the setting is called but there is one there.

The other way is to put your include at the top of global.php. This is usually called within 3 lines of other files calling it (the other lines are used to define variables). You can put the footer file in the function "outputpage" since this is called at the bottom of every page. This won't affect admin pages though.

The final way is to go through every file XD
you shold be note that if your pages start to send data before mybb's standard output you will fail to do your job normally
this is the reason that i didnt suggest decswxaqz's solution
be beauty
imei
i wanted to do this because my website has a menu at the top of the page, and a slightly more different menu at the bottom, and instead of sperating my site from the forums, i wanted to join them together
So you can edit templates... your needed template is:
header
footer
this two shown on all standard pages... but speacially you cam edit some of pages' template. this way you can view your menu top of index but not showthread... but if not , you can do first.. edit header and footer