71nr0q
Last Updated: February 25, 2016
·
2.751K
· penguinpaul
Z54qyaa

Use MyBB as your website engine

My last ProTip instructed you on how to be able to use MyBB within your current website by including global.php. This tip will show you how to use MyBB as the software that powers your whole website!

As with last time, start off your PHP file with this:

<?php
    define('IN_MYBB',1);
    require_once('global.php');

Not only can you use $mybb->user, $db, and other MyBB variables, you also have access to such theme variables like $header, $headinclude, $footer, etc.

Let's continue out PHP file.

$page = "<html>
<head>
<title>{$title}</title>
{$headerinclude}
</head>
<body>
{$header}
Your content here...
{$footer}
</body>
</html>";

Here you have defined the contents of a page that will output using the MyBB theme. Put your content where you need it, then after that put

    output_page($page);
?>

This will output your page using the MyBB theme!

My next Protip will show you how to go a step further and manage your custom pages from the MyBB Admin Panel.

Say Thanks
Respond