Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
  #1  
Old 01-29-2003, 08:17 PM
StatFox StatFox is offline
 
Join Date: Jan 2003
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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.
Reply With Quote
  #2  
Old 01-30-2003, 09:53 AM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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..
Reply With Quote
  #3  
Old 01-30-2003, 04:19 PM
StatFox StatFox is offline
 
Join Date: Jan 2003
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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!
Reply With Quote
  #4  
Old 01-30-2003, 05:22 PM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

vbulletin parses PHP inside only "PHPINCLUDE" template. So you'll be fine if you insert your code into this template
Reply With Quote
Reply

Thread Tools
Display Modes

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 01:54 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
  • Page Generation 0.03925 seconds
  • Memory Usage 2,181KB
  • Queries Executed 13 (?)
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
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)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_postinfo_query
  • fetch_postinfo
  • 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