MyBB Community Forums

Full Version: Php includes or SSI in templates?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, I have tested some script to include in mybb templates, but dont work. For example, a simple php script for random quotes, I tried with this:

<?
include('myserverpath/randomquote.php');
?>

But dont work.

How I can include php files in templates?
Thank you.
At the top of global.php after <?php, add:

ob_start();
include('myserverpath/randomquote.php');
$my_random_quote = ob_get_clean();

Then in your template use {$my_random_quote}
Thank you DennisTT
On an upgrade will this need to be done again?

And can I do multiple php files this way?
If global.php has changes then obviously yes, you'll need to make the changes again. otherwise, no.
Nevermind I found a plugin that will do the job.

http://community.mybboard.net/thread-402...#pid271885
(2009-01-13, 05:08 PM)MattR Wrote: [ -> ]If global.php has changes then obviously yes, you'll need to make the changes again. otherwise, no.

That's not acceptable solution then. The whole point of persuading the client to use myBB was for the ability to make modifications with hacking the core code.

Thankfully I found a plugin that does the job for me.
But the edit Dennis gave is just a small core file edit, so if that file where to be updated, you'd have to add it back, that's all I meant.