Hi Jim,

I recently answered a question offList for David Phillips. Perhaps the same answer may help here.

It was in reference to the Why Multi-Tier column at:
http://www.altuit.com/webs/altuit2/RunRevCaseStudies/Hemingway.htm


David wrote:
"After reading your Hemingway case-study, I was wondering if you could share a little more detail about exactly how you use Rev with ASP or, better yet, LAMP applications?
Since ASP and PHP are usually embedded in HTML, I'm not sure how to use Rev as a front-end to best effect. I wasn't sure if you used sockets or had designed your own framework or...? I'm basically trying to build a cross-platform UI for our PHP application."



David,

It's actually pretty easy-- if you already know a bit of php or asp.
If you don't there is a nice primer on server scripting for both .asp(Windows) or .php(Mac,Windows,PC) at:
http://www.w3schools.com/default.asp


For instance, say you have an .asp file on your server called http://www.altuit.com/test.asp

and it looks like this

<%
response.write "hello world"
%>

so to get it from the site, you would just call:

put URL "http://www.altuit.com/test.asp"; into tData

now tData has "hello world" in it.

You can easily add querystrings to your URL:

put URL "http://www.altuit.com/test.asp?name=chipp&password=fred"; into tData
which is a 'GET' method from the server which calls the test.asp file and sets it the values name=chipp and password=fred


The test.asp file runs, processes the information (perhaps it stores it in a database) and returns a string (perhaps 'true' if the password is good or 'false' if it is bad).

So, you do your database calls, etc from the server-side script, not from Rev.

To POST form data you use the 'post' command

say you have an html form you're trying to simulate with two fields "name" and "password"

so you just:

put "name="& fld "name" & "&password=" & fld "password" into tForm

--(note the '&' in front of password-- just like you're creating a queryString)

post tForm to URL "http://www.altuit.com/test.asp";

--> CHECK FOR ERRORS
put the result into tResult
if tResult is not empty then
   --> AN ERROR OCCURRED
   answer tResult
end if

--> tData IS STUFF RETURNED FROM FORM
put it into tData

if tData is "true" then
   --> DO SUCCESSFUL LOGIN STUFF HERE
else
   --> UNSUCESSFUL LOGIN STUFF HERE
end if


You may notice the above script checking the result. It's always a good idea to see if there's anything in the result, and if there is, handle it as it's probably an error of sorts. Even more elaborate would be a try/catch handler.


hopes this helps.

-Chipp

Jim Carwardine wrote:

Not to all of us, even though we want to do this.  Is there a primer with a
step-by-step procedure for creating this?  I'm just an old hat (HC
person)... Jim


_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to