Add Custom PHP Pages

by e8iw2f3 - 15-01-2015, 04:54 AM
Posts:
93
Joined:
Jan 2015
Likes:
6
Credits:
177
Reputation:
5
2 Years of Service
#1
OP
Posted: 15-01-2015, 04:54 AM (This post was last modified: 26-06-2016, 03:52 AM by e8iw2f3.)
Please register or login in order to unlock hidden content.
Newbie
Posts:
12
Joined:
Jan 2015
Likes:
0
Credits:
5
Reputation:
0
2 Years of Service
#2
Posted: 28-01-2015, 11:51 PM
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.
The last reply on this thread is older than a month. Please do not unnecessarily bump it.
Register an account or login to reply
Create an account
Create a free account today and start posting right away. It only takes a few seconds.
Login
Log into an existing account.
1 Guest(s)