The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
How do I set a $_REQUEST variable so that an included vB script will use it?
I am trying to display a thread (minus the header/footer and some other bits) in a webpage on the same server as my vB installation.
I have created a cut-down version of SHOWTHREAD template called SHOWTHREAD_inline. I have made a copy of showthread.php to showthread_inline.php and changed it to use the SHOWTHREAD_inline template. I have then included showthread_inline.php into my custom php script. It works but just shows the 'no thread specified' error. I can't set the ID of the thread I want to display. I have tried : PHP Code:
How do I do this, please? Thanks |
#2
|
||||
|
||||
Code:
if ($_REQUEST['t'] == '123456') { include_once("path/to/showthread_inline.php"); } = means This is now the same as That. == means This has the value of That. |
#3
|
||||
|
||||
Thanks for replying but you've got the wrong end of the stick.
What I need to know is how to have the showthread_inline.php script pick up on the value of the thread id. Assigning $_REQUEST['t'] to it's value before including the code doesn't work. THis is my test script: PHP Code:
I have looked at some of the vB code to see where request variables are 'received' to get a clue on how to do this. I have looked in init.php and global.php but don't see any sign of such code. (P.S. Quote:
|
#4
|
||||
|
||||
Oh I see. Request variables come from the URL itself. Look at the URL for this page, it'll either have a t (thread) or p (post) variable. Request is like POST or GET but with a few extras thrown in.
|
#5
|
||||
|
||||
Quote:
As I stated in my first post, I'm trying to include a (only slightly modified) version of showthread.php within my own php script. I want to send it a specific thread id. |
#6
|
||||
|
||||
PHP Code:
|
#7
|
||||
|
||||
Bingo!.
Who could possibly have thought it would be as blindingly simple as that! Cheers, Paul. Supplemental question. Rather than using PHP Code:
|
#8
|
||||
|
||||
Code:
eval('$var = "' . fetch_template('SHOWTHREAD_inline') . '";'); |
#9
|
||||
|
||||
Awesome! Thanks - I'm nearly there.
Implementing into the website, now and I'm getting a problem because I'm including the showthread_inline.php script within a function. (I don't have any choice at this point). I get an error: Quote:
Is there any way I can include it within a function? Many thanks |
#10
|
||||
|
||||
Add
PHP Code:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|