MyBB Tutorials

Add Custom PHP Pages

Submitted by e8iw2f3, , Thread ID: 28

Thread Closed
e8iw2f3
Member
Level:
1
Reputation:
17
Posts:
177
Likes:
13
Credits:
156
15-01-2015, 04:54 AM
This post was last modified: 26-06-2016, 03:52 AM by e8iw2f3
#1
Content locked
This content has been locked. Please login or register in order to unlock it.

RE: Add Custom PHP Pages

Ntll
Newbie
Level:
0
Reputation:
0
Posts:
11
Likes:
0
Credits:
5
28-01-2015, 11:51 PM
#2
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>
Then you could rename the template to something like "main_container" and reuse it throughout multiple pages.

Users browsing this thread: 1 Guest(s)