PDA

View Full Version : php to asp


Mixeh
19-11-2000, 04:34
just moving from php (which i know very little about) to asp (which i know even less about) because of access to a win2k server.

what i want to do is basicly turn this into asp and ssi:
<?php
if ($pika == 'jiggly') {include("jigglypuff.txt");}
elseif ($pika == 'bulba'){include("bulbasaur.txt");}
elseif ($pika == 'char') {include("charmandar.txt");}
elseif ($pika == 'claf') {include("clafairy.txt");}
else {include("pokemon_r_gh3y.txt");}
?>

i expect it will be much the same but dont want to start anything till im sure.

Would this be right?:
<%
if ($pika == 'jiggly') {<!--#include file="jigglypuff.txt-->}
else {<!--#include file="weeeeeeeeee.txt-->}
%>

Cheers

Elmo
25-11-2000, 14:41
Hmm... I think this would do what you want:

Well firstly ASP runs using VB Script, which is completely different (and also inferior in many ways) to PHP which is a C++ style language.

As far as I know you CAN'T have Include Statements written in like you want, but there is a workaround to this as below: (This example uses URL parameters to trigger the correct piece of text eg index.asp?pika=jiggly )

<%
If (Request.QueryString("pika") = "jiggly") Then
%>
' Insert HTML here or use <-- include virtual = "jigglypuff.txt" -->
<%
End If
%>

Then repeat that bit of code for all of
your required statements changing the relavent parts. On the last one use the following piece of code:

<%
If (Request.QueryString("pika") = "claf") Then
%>
' As above
<%
Else
%>
' As above
<%
End If
%>

Hope this helps you out, its not the most elegent way to do things, but it will definetly work. Also things to note is that the end of a statement is triggered using a new line, not a ; and also " is used in character fields.

Mixeh
29-11-2000, 07:23
cheers very muchy