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.
Thanks I'll check it out and let you know, from the description it sounds exactly as what I want but I wanna check first. Also please don't take this greedy but I'd rather not install plugins so if anyone knows how to achieve this without them please tell because I prefer them but I can settle with this one if I must.
OP:

Could you not just study the portal code, copy the side bar code and replicate it. But change a few attributes.

-Viral.
(2013-04-13, 04:32 PM)viral dragon Wrote: [ -> ]OP:

Could you not just study the portal code, copy the side bar code and replicate it. But change a few attributes.

-Viral.

That is what I'm doing, I just needed to be able to use PHP inside templates. Also the plugin suggested above worked. Thanks.