The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
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. |
#2
|
|||
|
|||
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.
|
#3
|
|||
|
|||
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.
|
#4
|
|||
|
|||
What are you trying to accomplish?
Sounds to me like you are overcomplicating things and trying to write unneeded coding. |
#5
|
||||
|
||||
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.
|
#6
|
|||
|
|||
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.
|
#7
|
|||
|
|||
Is the communication with the search engine asynchronous?
|
#8
|
|||
|
|||
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
|
#9
|
||||
|
||||
Can you wait for the external script to return results, or is it too slow to return data?
|
#10
|
|||
|
|||
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?
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|