MyBB Community Forums

Full Version: Include your custom pages in Mybb
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14
Heloo there,

In case you have made a new page (e.g a rules page) and you'd like to use it along to mybb! simply you will put a link to that page. but read this and you will have as a part of the board, with headers, navigation, footer etc....

let's start.

1st design the page you want, let's make a simple page

<html>
<head>
<title>{$mybb->settings[bbname]}</title>
{$headerinclude}
</head>
<body>
{$header}
<br />
<table width="100%" border="0">
<thead>
<tr>
<th>RULES</th>
</tr>
<tbody>
<tr>
<td>Our rules</td>
</tr>
</tbody>
</table>
{$footer}
</body>
</html>

now go to Admin CP > Templates > Modify / Delete > Expand "Global Templates" > Add template

call it rules
and put that code

now we have hot a template, ready to be used in our new page. note that you customize that the way you want, call it the name you want, as long as you are keeping the unity.

now let's make a new php file, let's call it rules.php

inside it put

<?php

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

add_breadcrumb("Rules page", "rules.php"); // (2)

eval("\$rules = \"".$templates->get("rules")."\";"); // (3)
output_page($rules); // (4)
?>

(1) is very important dont remove it, we need to to connect to the DB, to retrieve templates, to diplay the header and footer etc... , means it's our main part.

(2) is the navigation name, (e.g MyBB Community Forums / MyBB / General Support / New Thread ), so Rules page refers to what will appear Community Forums / Rules Page and rules.php is your page.

(3) from here we select which template, so replace rules with you custom name, in both parts.

(4) is the page that will output the template, same name of the template, however in case you have evaluated it with a different name in stage (3) use the evaluation call name, and not the template name.

ok now like that , you can make a link to that page and it will appear like this >> here, as any other page in the board.

hope you have enjoyed my tutorial, and that it was helpfull

regards

Edited by DennisTT
very very nice! thanks.. this should go on User Submitted Tutorials though
Very useful as usual!

Georges
Thank you for that tutorial Smile
have an example somewhere?
thanks
Good tutorial. (Oh and Happy Birthday)
works great Smile
+rep :p
Great tutorial, my pages seem to work perfect.
thanks, that helped a lot!
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14