Post Reply 
[MyBB TUT] Add new custom PHP page.
07-30-2012, 09:03 AM
Post: #1
[MyBB TUT] Add new custom PHP page.
Credit for me 4 posting and credit to crazy4cs for making.

I didn't found some good ones floating around. So here is how I create them and here is how you can create them.

Its quite easy. Here how you do.

First create, somepage.php file. Inside it, paste below code and save it:

PHP Code:
<?php 

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

add_breadcrumb("Title here""somename.php"); 

eval(
"\$html = \"".$templates->get("template_name")."\";"); 

output_page($html);

?>

Next, Themes & templates > Templates > Global Templates > Add template.

Add below example template:

Code:
<html>
<head>
<title>Your title here</title>
{$headerinclude}
</head>
<body>
{$header}
<table border="0" cellspacing="1" cellpadding="4" class="tborder">
<tr>
<td class="thead"><span class="smalltext"><strong>Your title here.</strong></span></td>
</tr>
<tr>
<td class="trow1">

Add here your custom messages.

</td></tr></table>
{$footer}
</body>
</html>

And for title, give any title to it but make sure you enter same title name in the somename.php file where it is calling (evaluating eval) the template name. As in this example case, you should enter title as template_name since we entered and recalled same global template in somename.php file.

Save the global template and it should work fine now.

cin caraha, proud to be a member of The Profiters since Jul 2012.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: