I understand that PHP isn't allowed in templates under MyBB's code. I recently downloaded PHP Manager to be able to create PHP files. However, when I select the no option when creating a page
I can use PHP. It works, but it's not quite what I want. A blank screen with some PHP on it isn't what I had in mind. I wanted the page to still look like the forum but have a content box where I can run PHP. After some looking up I found out I can recreate the basic template with the selection still set to no. You would think this would allow you to run PHP code, however, it does not. Here is the code for the page I used.
http://i.gyazo.com/d307db84d7ea71331cd5ee5ce8c4f8bc.png
My page looks perfect but it will not execute ANY PHP code whatsoever. It will execute HTML, but not PHP.
Upon looking up my problem I found a neat little code that allows this to happen called "PHP and Template Conditionals", which is an amazing plugin btw. It allows me to use PHP in my templates, but it will not allow me to use PHP with Page Manager. This has to be an easy fix but I just can't find out how to do it.
I can use PHP. It works, but it's not quite what I want. A blank screen with some PHP on it isn't what I had in mind. I wanted the page to still look like the forum but have a content box where I can run PHP. After some looking up I found out I can recreate the basic template with the selection still set to no. You would think this would allow you to run PHP code, however, it does not. Here is the code for the page I used.
<?php
global $headerinclude, $header, $theme, $footer, $templates, $lang, $mybb;
if ($mybb->user['usergroup'] == "6")
{
$a='<br>Sorry you cannot do that';
$av="<br>Hello ".$mybb->user['username'];}
elseif ($mybb->user['usergroup'] == "4")
{$a="<br>".$mybb->settings['bbname'];
$av="<br>Hello ".$mybb->user['username'];
$b="<br>Email :- ".$mybb->settings['adminemail'];
}
//echo $av;
$template = '<html>
<head>
<title>' . $pages['name'] . '</title>
{$headerinclude}
</head>
<body>
{$header}
{$errors}
<table border="0" cellspacing="0" cellpadding="0" class="tborder2">
<?php echo "test"; ?>
</table>
{$footer}
</body>
</html>';
$template = str_replace("\'", "'", addslashes($template));
add_breadcrumb($pages['name']);
eval("\$page = \"" . $template . "\";");
output_page($page);
?>
http://i.gyazo.com/d307db84d7ea71331cd5ee5ce8c4f8bc.png
My page looks perfect but it will not execute ANY PHP code whatsoever. It will execute HTML, but not PHP.
Upon looking up my problem I found a neat little code that allows this to happen called "PHP and Template Conditionals", which is an amazing plugin btw. It allows me to use PHP in my templates, but it will not allow me to use PHP with Page Manager. This has to be an easy fix but I just can't find out how to do it.