The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
How to use ASP code in the PHP pages...
PHP with ASP Code
Hello everybody... I have a question that may seem pretty simple to the folks in here. I just can't figure it out. Question: My website uses .asp code to rotate banners on all of the pages. The .asp code doesn't function inside the .php page. ---------------------------------- Here is the general code we use for the banners... If Request.ServerVariables("REMOTE_ADDR")="127.0.0.1" Or InStr(Request.ServerVariables("REMOTE_ADDR"),"loca lhost") Then strAdRotSchedFile=PathToRoot & "/ads/main/topbanner.txt" End If Set adRotate=Server.CreateObject("MSWC.AdRotator") strAdString=adRotate.GetAdvertisement(strAdRotSche dFile) Set adRotate=nothing Response.Write strAdString %> ---------------------------------- Does anybody know how to make the .asp work in the .php environment? Thanks for your help! And let me know if there are any questions. |
#2
|
||||
|
||||
No this is not a simple question, as a matter of fact it's a PRO question..
For one thing you can not parse ASP codes within PHP. So answer to your question is NO. However here are some work arounds: 1- (Strongly recommended) since you are on vb board now (thus PHP), it's a good idea to work with PHP scripts for everything in your site. So if possible I suggest changing your banner script too. For example PPN has a very nice advertisement hack or you can find a lot of free PHP banner scripts in the internet. 2- If you are determined to use your ASP script, your best bet would be call it as an external function inside PHP which means PHP will stop its working, pass the control to your alien script, then when it finished will resume working again. A bit awkard way and it's more awkard to adapt in vb since it may require hacking but still seems possible. This PHP command should do the trick for this: include ("http://www.yoursite.com/dir1/yourscript.asp"); However adapting it into vb is another story. It would work ok if you wanted its result be displayed instantly but you wouldnt want it since vb is template based and you would want to get its result into a variable first so that you can use it in the location you want in the relevant template. Well not an easy task, good luck.. |
#3
|
|||
|
|||
Thank you. We did try inserting a php ad rotator script into the template. It didn't run the code. Instead it simply displayed the code as if it were an HTML comment. Am I simply putting the PHP code in the wrong place? Is the customizable template designed_for HTML code only? If so, where should the PHP code be placed. Thanks again for any advice!
|
#4
|
||||
|
||||
vbulletin parses PHP inside only "PHPINCLUDE" template. So you'll be fine if you insert your code into this template
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|