MyBB Community Forums

Full Version: Create a custom page with MyBB Template?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How do I do it?

I just want the logo part, the header part, and the footer?
By creating the new template, out of the template code of what you want
Open up notepad and paste the following:
PHP Code:
<?php

define('IN_MYBB', 1); 
require "./global.php"; 

add_breadcrumb("Example Page", "example.php");

eval("\$example = \"".$templates->get("example")."\";"); 
output_page($example); 
?>
Replace "Example Page" with the navigation name you want.

Now, go to your Global Templates and create a template file titled whatever your PHP file is without the extension.
So, in this case, it's "example" (remember, no uppercase if it was not used before!)
Inside, paste the following:
Code:
<html>
<head>
<title>{$mybb->settings[bbname]} - Example Page</title>
{$headerinclude}
</head>
<body>
{$header}
<br />
<!-- Content: Start -->

<!-- Content: End -->
{$footer}
</body>
</html>

Change the Example Page to whatever you named your navigation bit (refer to the PHP file).
In between "<!-- Content: Start -->" and "<!-- Content: End -->" is what will show up to your users (aside from the header and footer)
Didn't work ... nothing shows up..

<?php

define('IN_MYBB', 1); 
require "./global.php"; 

add_breadcrumb("Videos", "videos.php");

eval("\$example = \"".$templates->get("example")."\";"); 
output_page($example); 
?>

<html>
<head>
<title>{$mybb->settings[bbname]} - Videos</title>
{$headerinclude}
</head>
<body>
{$header}
<br />
<!-- Content: Start -->

<!-- Content: End -->
{$footer}
</body>
</html>

What did I do wrong?
Oh I think I got it
Thanks alot it worked!
There's also a plugin, this may be easier:

http://community.mybb.com/thread-63082.html
Yeah I already got that one, tho I like fixing it like this ^^
(2010-06-22, 12:25 PM)NeoFusion720 Wrote: [ -> ]Yeah I already got that one, tho I like fixing it like this ^^

Did you make sure you saved it as a PHP file?
Tell us exactly what you did , what you named the php and html file , and post the php and html files youve created.
(2010-06-22, 12:16 PM)NeoFusion720 Wrote: [ -> ]Thanks alot it worked!