MyBB Community Forums

Full Version: 2 Questions: PHP in Templates and You-Tag-Mod
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all Smile

Switching from IPB 1 to phpBB now to MyBB I've got one little problem (so far Wink ). Is it possible to add PHP Code in the forum-templates (per include or direct?)? I've got a small random quote script (other than the existing mod for myBB - mine stores many the quotes in a flat file and shows it randomized on page refreshs) and no idea how I should integrate it, if I could'nt use php.

Could anyone upload the you-Tag-Mod please? I loved this mod in phpBB, but since mybbmods.com is down I can't get it.

Thanks Smile
The templates are stored in the database. PHP can't be executed safely from within the database. There is the option to edit your random quote script to output into javascript and use the script html tag to import an external javascript file that is actually the random quote script.
[you] tag mod attached below whilst MyBB Mods is offline. Please see the ReadMe included. Smile
As for the first one, templates can use $variables

so something like
<br />$title<br />$quote<br /><br />
in a template with
mySQL query ORDER rand()
$r = fetch array
$title = $r['title'];
$quote = $r['quote']
in the right file would work.

I made a random quote mod. Find it at http://www.mybbplanet.com/ and you can use the same basic structure.
Basically, you can put the PHP script within the MyBB file that you want the random quote to be displayed on and then add the variable into the template.
@TemplatesForAll
Thank you Smile But I could'nt figure out, how to read/parse a plain textfile with javascript (if it's possible at all..). So I had to write all quotes in the Javascript and thats exactly what I don't want Smile

@musicalmidget
Thanks. Works perfect Smile

@k776
I've your random quote mod installed. I've downloadet it, because I thought it were, what I want - a mod who really displays quotes random at any browser refresh. So I can allways set one quote, which any user sees, and have to manually edit these each time I want another. I've looked at your code, but I don't know, how to change it to serves the purpose I want. Sad

@Dennis
Thanks. I'll try that. Smile

I'm very surprised how fast I get help with my problems on this community. Thank you all Smile
NewRaven, when Gold is released, I'll work on exactly what you need plus a few other mods I now have planned.
Sorry for double post but I just completed a proper Random Quote for NewRaven and renamed the old one to Daily Quote. You can find it, and all other mods of mine here: http://www.mybboard.com/community/showth...p?tid=2423