![]() |
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 |
Code:
if ($_REQUEST['t'] == '123456') = means This is now the same as That. == means This has the value of That. |
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:
|
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.
|
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. |
PHP Code:
|
Bingo!.
Who could possibly have thought it would be as blindingly simple as that! Cheers, Paul. Supplemental question. Rather than using PHP Code:
|
Code:
eval('$var = "' . fetch_template('SHOWTHREAD_inline') . '";'); |
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 |
Add
PHP Code:
|
i have a custom page that uses a custom template, the template uses a plugin to include a php file, the php file uses the option:
PHP Code:
PHP Code:
i tried adding PHP Code:
Another problem i have is that i dont know how to add functions to a custom template too retrieving those functions from a plugin. |
Quote:
PHP Code:
PHP Code:
|
i sure did added it on the top of the file, that mistake it's because i wrote my post a lilllte bit too fast.., i have more variables inside it.
|
As Paul states, if it's a function, put global $vbulletin in the function it self. Not at the top of the file the function is in.
If it's not a function, you won't need a global statement to access $vbulletin. |
thank you.
|
You've all been so helpful with this thread. I couldn't get it to work in the end because when the content was displayed, some variables are not set.
What I'm trying to achieve here is to display a certain thread on a non-vb page on a website on the same server. Specifically we have a DVD reviews, and I want to display a specific discussion thread below each review. Isn't this something which would make an awesome hack if released properly? Are any of you guys interested? |
I butchered something together for just such a task a few weeks back - it's not perfect, but it does work.
Go here and download vBExternal, it says it's for 3.5.0 Beta 1 - but don't worry, it doesn't make any modifications to your forum, it doesn't even have any Plugins. Upload those files to your server. https://vborg.vbsupport.ru/showthread.php?t=83005 Open up the vBExternal.php file and follow on... Find: Code:
// --------------------------------------------------- Code:
// --------------------------------------------------- Code:
{post}... Code:
<?php Don't forget to CHDIR the file you're placing the code in. |
Thanks acidburn0520.
How difficult would it be to display the entire thread (with login info, reply buttons etc) as it would appear on the normal forum but without the header, footer and nav bar? |
Well the Reply Buttons would be easy, as you'd just need the ThreadID -- and there's already a modification that lets you put a Login on a non-vb page.
|
All times are GMT. The time now is 08:11 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|