MyBB Community Forums

Full Version: PHP code in a template?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a place I'd like to include some PHP code in a template (actually, I want to include a .inc file of html from an external file). I tried putting it in { } but it made a mess of things. <? and ?> in my template didn't work either.
In {} you can access variables; if you actually need code, I think there's a "template conditionals" or some such plugin that allows it. Alternatively you could learn how to use plugins to have MyBB run your own code... you could have this code set some variables which you could then in turn use in your templates.

If it's only about including text, if your server supports SSI and evaluates SSI after PHP, that could be an alternative...
hmmm. I tried the SSI hack, seemed liek I had to AddHandler server-parsed .php, and when I did this, it -all- blew up, so nope, don't think so.

maybe I'll have to rethink this. there's some external (non-MyBB) scripting on this server which updates this include file with radio station playlist info each time a new song is played... I want to include this in the header. I was hoping to not have to get into doing a myBB mod for this (mostly from not wanting to learn the whole mod system for something that's so system specific).
... update... ok, that mod did the trick. i'm happy now.