MyBB Community Forums

Full Version: How do you use PHP in template sets?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Alright so sorry if you read this and now noticed that it’s all changed. Anyways so I’ll first say what I have done and what I am trying to achieve. I made a new Global template called umm let’s just say “template-stuff”. Inside that template is:

<html>
<head>
<title>Pirate & Swagged teens</title>
{$headerinclude}
</head>
<body>
{$header}
<table>
  <tr>
    <td>
      <table border="0" cellspacing="0" cellpadding="4" class="tborder">
        <tr>
          <td class="thead"><span class="largetext"><strong>YO HO BELOW</strong></span></td>
        </tr>
        <tr>
          <td class="trow1">
            <p>YOLO</p>
          </td>
        </tr>
      </table>
    </td>
 	</tr>  
</table>
{$footer}
</body>
</html>

So now I go off making a newpage.php file (sorry I actually did this and the rest first) and placed it in my forum root directory. Inside this very small page is:

<?php 
  define('IN_MYBB', 1); require "./global.php";
  add_breadcrumb("MePage", "newpage.php"); 
  eval("\$html = \"".$templates->get("template-stuff")."\";"); 
  output_page($html);
?>

What I want to achieve is to be able to use php code inside the template-stuff (i.e. <?php echo some_array[row]). Is there any easy way of doing this? There must obviously LOL I just need to find the person who knows MyBB well enough. Tutorials out there now aren’t good enough for what I need (or their just different). Note that I am also trying to edit portal.php so that it has a sidebar on a template I have (didn’t have a sidebar thingy for the right) so now that I got the sidebar and all, I need to do the same thing above in this one but for the portal.

Now that I think about it? This might need to be moved? This is the closest that I can think of but I don't know now LOL. Also thanks in advance, I usually say that at the end of every help topic but forgot I guess.