MyBB Central

Full Version: Can i use PHP in theme?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi guys! Well right now im trying to use php in theme. I need to add some function with php, but i didn't get any.
I saw the plugin "PHP and Template Conditionals". With description: "Allows you to use conditionals and PHP code in templates."
I enabled it but i dont get that works. I dunno how to write it (cuz maybe there's a special way to write php in template)... so can somebody help me?
Thanks Wink
I am not sure, but i think you can do it with editing core files. (makes updating a bitch though (you need to make the edit(s) every time you upgrade)

for example in forumdisplay.php

$phpoutcome = "result of some function";

then make sure it's eval it into the template you want

for example:

eval("\$headerinclude = \"".$templates->get("headerinclude")."\";");


in the template add {$phpoutcome} where you want the result to appear.
Hum, yeah I understand but... I saw another way to do it... It was something like this:
Code:
<if $forum['fid'] == X then>
Do this
<else>
Do this other
</if>
And I havent tried it yet, but the problem is that i dont know how to use the template conditionals.
Here you can see more: http://community.mybboard.net/thread-31860-page-8.html
If someone can help...