The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
How would I call functions from forumhome in other templates?
I was looking over the template forumhome, and I found the various calls to functions such as $pminfo, $numbermembers, $totalthreads, etc. I was wondering what I had to do to incorporate some of these into the template forumdisplay, or possibly a different one.
I tried the obvious and just called the function from these templates, but they had 0 output, which leads me to believe that they're either contained within the forumhome php file or are called there and I need to include a call somewhere in forumdisplay. I'm new to PHP but I ran a UBB board for over a year and did a lot of modifications with it and what not. Usually I figure these things out myself, but I'm stumped on this one, since it's a new language to me. I see a lot of the things I want to do are in 3.0, but well, I'm rather impatient. Any help would be great! |
#2
|
||||
|
||||
The variables in the forum home templates are assigned by the code in forum/index.php
Take a look in there for the code for them. |
#3
|
||||
|
||||
Globalise the variables
Satan |
#4
|
||||
|
||||
Quote:
Declaring the global variables allows you to use them outside of there scope, eg using them within functions. |
#5
|
|||
|
|||
I see the functions, but not quite sure what I need to do. Is there a way to have the forumdisplay templates call those funtions from index.php, or do I need to copy the functions over? Seems a bit redundant to me to do it that way, but I'm unfamiliar with the way things work (been looking at the code for about a day, so I'm still figuring out how things work together).
|
#6
|
||||
|
||||
There not fuctions, the only function in index.php is the one to make the forum bits.
Yes you would need to copy the code from index.php to forumdisplay.php and add the variables like $totalthreads in the templates where you want them. |
#7
|
||||
|
||||
Couldn't you put the code for what you want in the phpinclude template and use it globally from there, too?
|
#8
|
||||
|
||||
You could indeed, however I'd not suggest the phpinclude method unless its used on every page, its gonna add maybe 4 queries per page, which is very wastefull, especially if the info isn't been used on 90% of the site . I also wouldn't suggest adding it to forumdisplay, but thats just me.
|
#9
|
|||
|
|||
I can't see it being that big of a deal to add the queries if Vbul 3.0 beta is doing the same thing. Granted I don't know how they have it coded.
Btw, I got it to do what I wanted, so I appreciate the help, even if you don't condone it |
#10
|
||||
|
||||
ok, this is a totally stupid question, but where do you define your global variables? I added a new table to my database and i would like to be able to refer to one of the fields in it from 2 different files.... thanks in advance for help.
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|