MyBB Community Forums

Full Version: Pull $header, $headerinclude, and a few others on subdomain/inner directory?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'd like to be able to use the following on pages in a subdirectory connect to a subdomain:
<html>
<head>
<title>{$mybb->settings['bbname']}</title>
{$headerinclude}
</head>
<body>
{$header}

{$footer}
</body>
</html>

Setup
Subdomain
  • handbook.mydomain.com
  • connected to folder /home/username/public_html/handbook
MyBB Installation
  • mydomain.com
  • connected to folder /home/username/public_html

Can anyone guide me in the proper direction to go about this? It would be greatly appreciated.

Ideally every page in the subdomain would mimic MyBB's header, headerinclude, and footer templates (so logged in status, header contents, footer and theme switcher, etc. along with images and theme css).
That's hard to implement, because the header templates are "compiled" by MyBB routines, that needs a couple of *.php files to include exceptionally.

I guess the header will not change over time, so better copy the "compiled" source code from MyBB over to your subdomain site. Make changes to image paths etc.

Or do you want to implement the member stuff in your subdomain site as well?

What about creating own custom pages within MyBB and adopt your "handbook" into MyBB?
This can also be done with creating a page and using an <iframe> to implement the subdomain site.

[ExiTuS]
Peharps the old method I used with 1.6 works:
<?php
define('IN_MYBB', 1);
require '../global.php';
global $mybb;
$template = "<html>
<head>
   <title>what you want</title>
   {$headerinclude}
</head>
<body>
{$header}
your content
{$footer}
</body>
</html>";
eval("\$page = \"".$template."\";");

output_page($page); 
(2022-11-03, 03:46 PM)[ExiTuS] Wrote: [ -> ]That's hard to implement, because the header templates are "compiled" by MyBB routines, that needs a couple of *.php files to include exceptionally.

I guess the header will not change over time, so better copy the "compiled" source code from MyBB over to your subdomain site. Make changes to image paths etc.

Or do you want to implement the member stuff in your subdomain site as well?

What about creating own custom pages within MyBB and adopt your "handbook" into MyBB?
This can also be done with creating a page and using an <iframe> to implement the subdomain site.

[ExiTuS]

My hope is that the header and footer having all the very important parts for theme, userblock, and so on would replicate on the subdomain as well. I originally had planned to just work the document into the MyBB software with handbook.php and then additional pages would work with handbook.php?page=name but I much prefer the subdomain aspect. However, if I cannot get it working that way I'll probably go back to a custom page.

(2022-11-03, 08:12 PM)Crazycat Wrote: [ -> ]Peharps the old method I used with 1.6 works:
<?php
define('IN_MYBB', 1);
require '../global.php';
global $mybb;
$template = "<html>
<head>
  <title>what you want</title>
  {$headerinclude}
</head>
<body>
{$header}
your content
{$footer}
</body>
</html>";
eval("\$page = \"".$template."\";");

output_page($page); 

This is somewhat close to what I had that was just spitting out the actual variable instead of what the variable is and not carrying over the templates from header, headerinclude, settingsbbname, and footer. Although I did use the absolute path with require_once trying to mimic what I say on the top of the index.php file for MyBB lol.
<?php
define('IN_MYBB', 1);
define('THIS_SCRIPT', 'index.php');

require_once '/home/username/public_html/global.php';

?>
<html>
<head>
<title>{$mybb->settings['bbname']}</title>
{$headerinclude}
</head>
<body>
{$header}

 I am a test.

{$footer}
</body>
</html>

After putting in your code my page throws a 500 error "Page isn't working".