MyBB Community Forums
Include your custom pages in Mybb - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Resources (https://community.mybb.com/forum-8.html)
+--- Forum: Tutorials (https://community.mybb.com/forum-38.html)
+--- Thread: Include your custom pages in Mybb (/thread-6615.html)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14


Include your custom pages in Mybb - zaher1988 - 2006-02-08

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


RE: Include your custome pages in Mybb - webaph - 2006-02-08

very very nice! thanks.. this should go on User Submitted Tutorials though


RE: Include your custome pages in Mybb - gsa - 2006-02-09

Very useful as usual!

Georges


RE: Include your custom pages in Mybb - Boring Dude - 2006-02-09

Thank you for that tutorial Smile


RE: Include your custom pages in Mybb - xiao - 2006-03-26

have an example somewhere?


RE: Include your custom pages in Mybb - xiao - 2006-03-26

thanks


RE: Include your custom pages in Mybb - Dale Hay - 2006-03-26

Good tutorial. (Oh and Happy Birthday)


RE: Include your custom pages in Mybb - xiao - 2006-04-01

works great Smile
+rep :p


RE: Include your custom pages in Mybb - SS Unknown - 2006-04-01

Great tutorial, my pages seem to work perfect.


RE: Include your custom pages in Mybb - nekng - 2006-04-22

thanks, that helped a lot!