The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Getting forum ID through php?
I was wondering how you go about getting the forum ID put into a variable or even just echo'd through PHP. Does it have anything to do with using the $_REQUEST['forumid']? Could someone give me a short code sample of how to echo a forum ID through PHP or point me to a topic that does? Just using "echo $_REQUEST['forumid']" doesn't work. I've tried searching but I can't find anything specific to what i need. thanks.
|
#2
|
||||
|
||||
It depends on where you are using the variable. Most people use it in a template and you can see all the places it is used in a template by doing a Search In Templates for "forumid" (no quotes). Note that the exact name of the variable is different depending on what template it is used in.
|
#3
|
|||
|
|||
I'm actually using it in a .php file which is displayed by a vbadvanced module. Would i need to connect to my database and pull the forum id from there instead? $foruminfo[forumid] isn't working.
--------------- Added [DATE]1235936765[/DATE] at [TIME]1235936765[/TIME] --------------- Actually when i put require_once('./global.php'); at the top of the page, i can get "echo $_REQUEST['forumid'];" to display '0', but not '5' which is the actualy forum id. Any ideas? |
#4
|
||||
|
||||
Have you tried just $forumid? And, what are you getting the forumid *of*? That is the clue to actually getting it because you need to pull it from whatever query you are using. Unless you are actually in a forum, you won't have a forumid of anything unless you query for it.
|
#5
|
|||
|
|||
$forumid didn't work. I'm trying to get the forum ID of the forum that contains the module with this php file. I tried having it connect to the database and use "SELECT forumid FROM forum" but this output "Recource id #3" instead of '5', which again is the actual forum id that contains the module. I think i'm getting myself way off track...
|
#6
|
|||
|
|||
Would you mind clarifying your entire objective a little more? After reading this Lynne has provided a solution, but I don't quite understand what you are looking for.
// Edit // Is the forumID static or dynamic? What are the conditions? |
#7
|
|||
|
|||
Alright I am using vbadvanced. I have a module of my forum which outputs a .php file. In this php file, i would like to find out the forum id in order that i might display something specific to each forum in that module. Just to keep things simple, though, i would like to echo or assign to a variable the forum ID that contains this module and php file. Basically when the page is loaded and the php file is loaded i want it to check the forum id so that i can set specific functions based on that forum id.
|
#8
|
|||
|
|||
If I am not mistaken you are looking for something that does the following:
-When the forum page loads it checks the ForumID. -If the forum ID matches a specific command, it outputs X item. If this is what you are looking for, this is just a simple if else function. PHP Code:
|
#9
|
|||
|
|||
$forumid decided to start working, i guess i missed it earlier. This is exactly what i needed, thank you both very much and i'm very sorry for misunderstanding so much.
|
#10
|
|||
|
|||
No problem, was my code of any assistance, or were you simply in need of the $forumid portion?
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|