Thread Rating:
  • 16 Vote(s) - 4.38 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Include your custom pages in Mybb
#1
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
Reply
#2
very very nice! thanks.. this should go on User Submitted Tutorials though
Reply
#3
Very useful as usual!

Georges
[Image: 468x60-qnhl.gif]
Happily powered by Mybb!
Reply
#4
Thank you for that tutorial Smile
1.4 say what Big Grin
Reply
#5
have an example somewhere?
[Image: gfxsig0em.jpg]
Please visit GFX-Depot | My theme | Google Battle
----------------- Vote for MyBB
-----------------
Reply
#6
thanks
[Image: gfxsig0em.jpg]
Please visit GFX-Depot | My theme | Google Battle
----------------- Vote for MyBB
-----------------
Reply
#7
Good tutorial. (Oh and Happy Birthday)
Reply
#8
works great Smile
+rep :p
[Image: gfxsig0em.jpg]
Please visit GFX-Depot | My theme | Google Battle
----------------- Vote for MyBB
-----------------
Reply
#9
Great tutorial, my pages seem to work perfect.
[Image: sigsmall.jpg]
Reply
#10
thanks, that helped a lot!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)