The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Trick to using VB variables on Non-vb pages...
Ok...
Do i have to use ECHO commands in order to use the variables within GLOBAL.php? I thought it was simple as this... <html> <? require("global.php"); ?> <p> Hello... my name is $username</> </html> but... i assume you have to do the following: <html> <? require("global.php"); echo('<p> Hello... my name is $username</>'); ?> </html> Is there an easier way... what is the right way? I want learn to code indpependent pages of VB but use the VB variables.... if the echo command is the only way then so be it... but I do a visual/code upgrade every 6 months and the echo command may seem to be bit too much... Everyone has asked this question... and the response is just use GLOBAL.php and sessions in the url... etc... but how... write out some sample code for the newbies.... and once we learn how we will do the same... Thanx |
#2
|
||||
|
||||
Firstly only require global.php once at the top of the page, then you have all of the vB variables and functions avalible to you:
PHP Code:
|
#3
|
|||
|
|||
hmmmm, not quite. If the file that is calling global is outside of the forum tree then global.php is going to bomb out as soon as it starts hitting the require()'s. I'd like to know if there's an abstraction method to get accurate paths all the time, whether global.php is being called within the directory tree as in vBulletin or if it'bs being called from outside.
Aaron |
#4
|
||||
|
||||
why not put ./forum/global.php ?? soz just my thought i dont even know php lol
|
#5
|
|||
|
|||
Actually that doesn't work in the slightest.
In my /public/ directory, I want my index page. /vB/global.php is the location of global.php from my index page, and this is what I used: PHP Code:
|
#6
|
|||
|
|||
yup, exactly. change the filename to global2.php and you'll get an error that it can't find the include path. when it's just global.php there's no error so you have the right path and file. Problem is the require()'s. require is similar to include() but when require() returns false it immediatley ends all execution of the php. It just ends.
Now you could replace all the require()'s with include()'s but you'll still get errors because basically the file being called is not inexistence...because it's calling it fropm your external page path and noth the vb page it was meant to be called from. If it was called from a vb page it would return true, but if not, it returns false thus breaking the script. This is also why require() exits. Because the files being require()d are non-existent. There has to be another way. Aaron |
#7
|
|||
|
|||
Well if you understand that, surely you know how to get around it...
|
#8
|
|||
|
|||
I suppose that's why I'm wasting my time on these forums. :rolleyeyes:
I've just spent the better part of a day importing an ikonboard to vB. I really don't need that. If I knew what to do I wouldn't be asking. I mean, sure I could change the require()'s to include()s but that doesn't solve the path problem, and if I fix the path problem it;s bound to cause problems elsewhere. That's why I'm asking....how would YOU do it? And please, no bull++++ answer. If you don't know, say that. If you do, don't play games, just tell me. Thanks Aaron |
#9
|
||||
|
||||
well if you just want to use the $bbuserinfo variables coudln't you copy the global.php to the folder your using your index.php in? im not sure, just a thought
|
#10
|
|||
|
|||
wouldn't fix paths. I'd have to copy EVERYTHING over or at leas tthe files it's trying to include. That just doesn't seem like a valid solution to me.
Aaron |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|