PDA

View Full Version : Displaying a random number in forumdisplay.php


Chunky Monkey
10-14-2008, 11:28 AM
Hello, how can I display a random number above the list of topics in a forum? I imagine I have to add code to forumdisplay.php but I am not sure where. I come from phpbb2 where variables would be built in the php files and then displayed in the .tpl files, but I'm having trouble following how this works in vbulletin so far. Can you please tell me how to achive something like this:

(looking at a forum)

The random number generated is 32.

Thread 1
Thread 2
Thread 3

Lynne
10-14-2008, 02:00 PM
In vbulletin, you would use a plugin to 'plug into' the php file. You plug into a hook. If you look at the forumdisplay.php file, you will see several lines like this:
($hook = vBulletinHook::fetch_hook('forumdisplay_start')) ? eval($hook) : false;

That is a for a plugin. So, if you write a plugin using the hook location 'forumdisplay_start' then the php code is 'entered' right there in the file.

Then, after you write the plugin, you display the results in a template file. For forumdisplay.php, the main template file is FORUMDISPLAY.