Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-03-2002, 04:26 PM
memobug memobug is offline
 
Join Date: Jun 2002
Posts: 418
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default calling an external script with arguments

Greetings,

I tried this in Templates but either it went unnoticed or no-one knew/cared?

I have put together a vbulletin/photopost integration that will print several of a user's last photopost uploads in their profile.

to get this to work, I have to be able to call an external php script and pass the userid as a command line argument, something like

thumbnail.php?user=$userid

This way the script knows which user's photos to print!

But, when I do this, I don't get the $userid variable passed. When I put that into phpinclude template the script gets called but it passes "$userid" instead of the actual variable content (id of the user).

Does anyone know how to call an external script passing arguments like this?

Thanks!

Matt
Reply With Quote
  #2  
Old 08-04-2002, 02:02 AM
JulianD's Avatar
JulianD JulianD is offline
 
Join Date: Jan 2002
Posts: 455
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

To call the userid of the logged user, in templates, you should use $bbuserinfo[userid].
Reply With Quote
  #3  
Old 08-04-2002, 02:43 AM
memobug memobug is offline
 
Join Date: Jun 2002
Posts: 418
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks, but actually that's not the question. The question is how to pass a variable or argument (such as $bbuserinfo[userid]) or any vB variable for that matter, to an external target script as in the include call, such as:

myphpscript?variable=$bbuserinfo[user]

at any rate I want the userid of the profiled user, not the logged user. I keep getting the literal text, such as, "$bbuserinfo[user]" not the variable contents, sent.

Regards,

Matt
Reply With Quote
  #4  
Old 08-07-2002, 04:49 AM
memobug memobug is offline
 
Join Date: Jun 2002
Posts: 418
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Greetings,

I find it hard to believe no one had passed a vbulletin variable to an external script. Is it not possible?

Regards,

Matt
Reply With Quote
  #5  
Old 08-08-2002, 04:47 PM
tHE DSS's Avatar
tHE DSS tHE DSS is offline
 
Join Date: Jun 2002
Location: UK
Posts: 113
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hiya... post a small snippet of your code... the part where you are trying to do this task?

Perhaps it's just somthing simple, like, you are generating the URL outside of the <?php ... ?> tags.
Reply With Quote
  #6  
Old 08-08-2002, 06:39 PM
memobug memobug is offline
 
Join Date: Jun 2002
Posts: 418
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for a response,

at any rate, I have an independent script. I just want to pass the USERID to it so that it can print the appropriate thumbnails and call it from within the user's profile template.

the actual url I am including is like:

http://www.ip-sys.com/~bonsai/pictur....php?myuser=XX

I want to pass the user id to it so when you're in Vbulletin user 37's profile it includes

a) http://www.ip-sys.com/~bonsai/pictur....php?myuser=37

when you're in user 5 it includes

b) http://www.ip-sys.com/~bonsai/pictur...r.php?myuser=5

Those are live links by the way. I think the actual code is irrelevant to the question. It's a question of how to pass variables from vBulletin to another script, any script.

obviously, I need to append a vBulletin variable in place of the XX in myuser=XX, but no matter which one I include, my script receives the variable NAME not its value.

Getting the generic include to show in the user profile is no problem, I just can't get the userid variable to pass. It keeps getting sent as a variable name and not resolved to a number.

Thanks again,

Matt
Reply With Quote
  #7  
Old 08-08-2002, 11:30 PM
tHE DSS's Avatar
tHE DSS tHE DSS is offline
 
Join Date: Jun 2002
Location: UK
Posts: 113
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ooo... me girlfriend keeps asking me for one of them trees.

Anyway... where did you say you were calling the external script from again? And, in that PHP code, are you using somthing similar to :

PHP Code:
$URL "http://www.ip-sys.com/~bonsai/pictures/thumbprofiler.php?myuser=$bbuserinfo[userid]";

echo 
"<a href='$URL' target='_blank'>Click Here</a>"
If you are calling the external script from within vB, that should work.

I'm doing somthing very similar, with userid, username and sessionhash at the place i'm currently building, and it works.

I'm doing these things from scripts completely independant from the vB scripts, and it's just a case of putting :

PHP Code:
require('./global.php'); // or relative or absolute path 
... at the top of the script. But all vB scripts have that already.

Another thing to watch for, is trying to use variables outside the <?php ...... ?> tags.... i've done that before now, and pulled my hair out wondering why variables aren't being processed. :classic:

As the recieving script is recieving your variable name, i'll assume for now that you have the generating PHP, outside the PHP tags.

:smoke: :smoke: :smoke: relax, it'll get working soon enough.
Reply With Quote
  #8  
Old 08-09-2002, 12:16 AM
memobug memobug is offline
 
Join Date: Jun 2002
Posts: 418
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi there tD,

Are you suggesting that I put the <?php ...... ?> right into the template, or something else?

I am trying to get it to display in the action=getinfo display, so I called the script the way I did my other includes. Those work, but don't require any info from vB:

1. So, put the script call into php-include template:
Quote:
$userthumb = implode("", file("http://www.ip-sys.com/~bonsai/pictures/thumbprofiler.php?inorder=latest&myuser=$bbuserinf o[user]"));
2. Then put that name ($userthumb) into the User Info Display template
called "getinfo"

Quote:
<!-- MEC 080102 try userthumb -->
<tr>
<td bgcolor="#1C5780"><normalfont><b>Recent Images:</b></normalfont></td><td bgcolor="#1C5780"><normalfont>$userthumb</normalfont></td></tr>
<!-- MEC 080102 /end try user thumb-->
When I try that, the script gets called, images get pulled into the userinfo template, but they are for the wrong (and same) user no matter what I put as the $myuser=variable name in php-include.

Thanks for looking!

Matt
Reply With Quote
  #9  
Old 08-09-2002, 12:31 AM
tHE DSS's Avatar
tHE DSS tHE DSS is offline
 
Join Date: Jun 2002
Location: UK
Posts: 113
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I didn't realise you were using the templates... that bombs out the thought of dodgy PHP tags.

Ummm... i'm just extremely tired... I should have been in bed hours ago... i'll be a zomby at work tomorrow (today, technically).

If i'm giving you no joy, hopfully at least this can get the ball rolling for others to help.

Anyway... i'm not sure about the php-include template... i've never been sure of it's stability in doing code for extra needs.

But, try putting your link/url generating code into the vB script that you need it from... or whack it into the global.php script if you need it everywhere.

.. then your $userthumb values may work.

In the admin/functions.php, you see :

// ###################### Start getuserinfo #######################

... after that... well, you can guess.

Put your code after all the userinfo generating, if you wish. Or in the forums/global.php, after :

// ###################### Start functions #######################

.. where the functions.php get's "required".
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:03 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04347 seconds
  • Memory Usage 2,248KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete