MyBB Community Forums

Full Version: Howto make extra page !
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
That's not what I meant, this is a on-the-run cache, deleted after script ends. Runs one query instead of 20 or something like that.
xiaozhu Wrote:Make Custom Pages - MyBB 1.2 (updated from zaher's guide)


1. Design your page using simple HTML
<html>
<head>
<title>{$mybb->settings['bbname']}</title>
{$headerinclude}
</head>
<body>
{$header}
<br />
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<thead>
<tr>
<td class="thead"><strong>RULES</strong></td>
</tr>
<tbody>
<tr>
<td class="trow1"><p align="center">My RULES</p></td>
</tr>
</tbody>
</table>
{$footer}
</body>
</html>

2. Go to Admin CP > Templates > Modify / Delete > Expand > Add Template - name it rules & insert the code above.

3. Lets make a new php file now, and call it rules.php & put the following code in it
<?php
define("IN_MYBB", 1); 

require "./global.php"; // (1)

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

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

(1) You should never remove it because we need to to connect to the DataBase to retrieve templates, to display the header and footer etc...

(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.

A demo is available here.

Couple of question on this one :

1. If I put my "rules.php" in a subfolder, what do I have to change ?
2. Can I now call this template inside another with {$rules} ?
Sorry for the double post, but I just tried this ... exactly like the example and the only thing I see is a blank page.
I had a blank page too until I added this

$templatelist = "rules";

Add that after this line

define("IN_MYBB", 1);
the cellpadding on this seems kind of off. when i add list elements with <li> the bullets are outside of the table!
May i ask if this info regarding creating extra pages for MyBB is up to date with the latest version of MyBB? i just want to know if there are any changes to the code and anything that may need updating from the sample in this thread please, before attempting it myself.

If you know of any neccessary changes please show them here, thanks.
I did make a plugin for a one page if you want it. You'll have a template for it and can change the text on it in the Configurations page in the ACP.
What kind of page do you want to make?

I find one the easiest methods is to use the error() function.

<?php

define("IN_MYBB", 1);

require_once "./global.php";

$title = "This is the title";
$body = "this is the body";

error($body, $title);

?>
Call that test.php and upload it to your mybb root folder. That's about as easy as you can get to create a static page.
rcpalace Wrote:I did make a plugin for a one page if you want it. You'll have a template for it and can change the text on it in the Configurations page in the ACP.

rcpalace, would i be able to get that plugin from you please?


labrocca Wrote:What kind of page do you want to make?

I find one the easiest methods is to use the error() function.

<?php

define("IN_MYBB", 1);

require_once "./global.php";

$title = "This is the title";
$body = "this is the body";

error($body, $title);

?>
Call that test.php and upload it to your mybb root folder. That's about as easy as you can get to create a static page.

I need to make a privacuy policy page.
labrocca Wrote:What kind of page do you want to make?

I find one the easiest methods is to use the error() function.

<?php

define("IN_MYBB", 1);

require_once "./global.php";

$title = "This is the title";
$body = "this is the body";

error($body, $title);

?>
Call that test.php and upload it to your mybb root folder. That's about as easy as you can get to create a static page.

Hi labrocca, i uploaded that and see a page but above it the following error shows:

Warning: Cannot modify header information - headers already sent by (output started at /home/content/c/o/s/cosplaymint/html/forum/test.php:1) in /home/content/c/o/s/cosplaymint/html/forum/inc/functions.php on line 1216
Pages: 1 2