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

Reply
 
Thread Tools Display Modes
  #1  
Old 12-27-2008, 01:53 PM
neof neof is offline
 
Join Date: Dec 2008
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Pass variable from Template to PHP

I'm using 3.6.8. I want to include my own php code into the FORUMDISPLAY template after
<body>
$header
$navbar
<-------------insert my code here

1) How do I pass the variable like $foruminfo[title] from the templates into the PHP file?
The php file will process the $foruminfo[title] value and the result is inserted back into FORUMDISPLAY template.
Reply With Quote
  #2  
Old 12-27-2008, 02:04 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You don't pass those variables like that from a template to a PHP script. They are passed from a PHP script to the template.
Reply With Quote
  #3  
Old 12-27-2008, 03:01 PM
neof neof is offline
 
Join Date: Dec 2008
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks I need to know the user's current pages' info such as Forum Title, so I am guessing that I have to get the info from the template, because the external php script don't know what page the user is on. I think I get the info from the template, pass it to the php file, and the result of the php file is passed back into template to display to user. Pls let me know if there is other method to process the forumtitle for each user.
Reply With Quote
  #4  
Old 12-27-2008, 03:04 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What are you trying to accomplish?

Sounds to me like you are overcomplicating things and trying to write unneeded coding.
Reply With Quote
  #5  
Old 12-27-2008, 03:22 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How are you calling the script? From a plugin? If so, the information you are wanting is most likely all ready available to you. Perhaps if you are a bit more specific here, we can help you out better.
Reply With Quote
  #6  
Old 12-27-2008, 03:44 PM
neof neof is offline
 
Join Date: Dec 2008
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

when a user visits any forum page, I want to extract the forumtitle on that page and pass it to a phpscript which will insert the forumtitle into an api to an external searchengine. That searchengine will return some results back to the phpscript, and I need to display that result back to the user on his current page. Example: As soon as a User visits any forum page (assume a page's title is called "games"). I need to extract "games" and send that to the searchengine which returns "arcade game, video games, flash games, etc" which I need to display "arcade game, video games, flash games, etc" back to the user on whatever the page that just loaded for the user.
Reply With Quote
  #7  
Old 12-27-2008, 03:52 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is the communication with the search engine asynchronous?
Reply With Quote
  #8  
Old 12-27-2008, 08:47 PM
neof neof is offline
 
Join Date: Dec 2008
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think yes it is asynchronous because we don't know when the users visit the pages or which page. as soon as the page loads, the forumtitle is extracted, passed to php, passed to api which returns the results to php, and passed back to the loaded page to show the info to the user. pls let me know if there is a better way
Reply With Quote
  #9  
Old 12-28-2008, 03:13 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can you wait for the external script to return results, or is it too slow to return data?
Reply With Quote
  #10  
Old 12-28-2008, 05:32 AM
neof neof is offline
 
Join Date: Dec 2008
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm not worried about the speed of the external php script since the returned results is instant. How do I pass the forumtitle of the loaded page to that php script, and pass the result back to the loaded page?
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 09:21 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.08351 seconds
  • Memory Usage 2,241KB
  • 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
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete