Quote:
May I ask how exactly I can determine which hook to use in the future?
|
It's possible to guess at a hook location that might work for a given purpose, but I think the only sure way to choose a hook location is to look at the php code, understand a little about what's going on, and find one that's in the place you want. For example, you needed one where the variables on the forumdisplay page had all been set, but before the FORUMDISPLAY template is used (because you need $displayresources defined before that happens). So I looked in forumdisplay.php. In this case it wasn't too hard, there happens to be a hook location right before the FORUMDISPLAY template is fetched and eval()ed. I remember when I started out this seemed counterintuitive because I figured if I wanted my changes to show up near the top of the page, it should be somewhere near the top of the php file, but it doesn't work that way in vb.
Quote:
Also if I wanted to display my customized forumdisplay I would do the condition like below?
|
I'm not sure what you're asking, but yeah, you could put what you have there in the FORUMDISPLAY template around $displaysources, or you could do something like this in your plugin:
Code:
if (in_array($foruminfo['forumid'], array(35,36,12,15)))
eval('$displayresources = "' . fetch_template('displayresources') . '";');
else
$displayresources = '';
Then $displayresources would just be blank in other forums.
Quote:
Also if I wanted to make a customized display, lets say forumbit, I would do the same method except for the hook I would use the forumbit_complete?
|
What I would do is find where the forumbit templates are used, then look around the code for a convenient hook. You could also guess that forumbit_complete sounds like a likely candidate (assuming there is a hook of that name), find it in the code, and see what's going on around it. I realize this is often difficult for a non-programmer. I see a lot of people posting to ask what hook they should use, which is another good way to do it.
BTW, having an editor or other program that lets you search a set of files (on your local computer) helps immensely. Also, I use this site a lot for PHP reference:
http://us2.php.net/tut.php