MyBB Community Forums

Full Version: Can't write php when editing themes?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi guys,

I want to edit my MyBB forum into the layout of my site, which basically just means adding my top navigation bar and footer to the MyBB code.

I went to Admin CP > Templates > My Template and found the "header" and "footer" files. I also verified that these are indeed generating the code right after <body> and right before </body>.

I went to add my top navigation code to the header file (pasted below) and got the following error:

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING

I use a php include function to bring in my header, but it looks like you can't use the <?php ?> tag when editing templates? How can I use php when editing templates? I've looked all over the place for an answer for the last 30 minutes and found nothing, so I'm asking you kind folks Smile

Thanks,

Chris

My header code:
<div class="canvas">

<?php include($_SERVER['DOCUMENT_ROOT'].'/include/masthead.php') ?>

<div class="maincontent">

<div style="clear:both"></div>

Nevermind, I think I may have found an answer here:

http://community.mybb.com/showthread.php?tid=4385
Double nevermind. The thread I found was actually outdated, and the advice in it doesn't seem to work anymore.

Apparently I can add php to my global.php file and output it via a variable, but the instructions in the linked thread don't work. Can someone please explain how this works?

Thanks.