[mybb] custom php pages 03-12-2016, 03:02 PM
#1
First create, somepage.php file in ROOT or forum directory. Inside it, paste below code and save it:
Next, Themes & templates > Templates > Global Templates > Add template.
Add below example template:
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.
[/quote]
What I like to do on creating new pages is having a few variables. Title and content are the most important of course. You can even eval() the title variable to use as the content box title too, like such:
What I like to do on creating new pages is having a few variables. Title and content are the most important of course. You can even eval() the title variable to use as the content box title too, like such:
Template:
Then you could rename the template to something like "main_container" and reuse it throughout multiple pages.
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.
[/quote]
What I like to do on creating new pages is having a few variables. Title and content are the most important of course. You can even eval() the title variable to use as the content box title too, like such:
What I like to do on creating new pages is having a few variables. Title and content are the most important of course. You can even eval() the title variable to use as the content box title too, like such:
PHP Code:
<?php
define('IN_MYBB', 1); require "./global.php";
$page_title = "Page title";
$content = "Some random content";
add_breadcrumb($page_title, "somename.php");
eval("\$page_title =\"". $page_title . "\";");
eval("\$content =\"". $content . "\";");
eval("\$html = \"".$templates->get("template_name")."\";");
output_page($html);
?>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>{$page_title}</strong></span></td>
</tr>
<tr>
<td class="trow1">
{$content}
</td></tr></table>
{$footer}
</body>
</html>Wanna be here? Donate NSP to me will go in rank order = More you pay the higher you will be!
@zorrophreak -75-nsp
@Rick - 50~nsp
@Customer - 10~nsp
@insidious15 - 6~nsp
@Diego - 1~nsp
@Logo - 1~nsp
@zorrophreak -75-nsp
@Rick - 50~nsp
@Customer - 10~nsp
@insidious15 - 6~nsp
@Diego - 1~nsp
@Logo - 1~nsp






![[+]](https://sinister.li/images/modern/collapse_collapsed.png)