|
Post by waybackman on Apr 12, 2010 0:20:10 GMT -5
I admit that I'm a total newbie when it comes to RunBasic (despite having purchased it quite some time ago) so perhaps I'm wrong, but you kind folk will be able to point me in the right direction, I'm sure.
It seems to me from a brief reading of how RunBasic works, that it's not possible to write a web page with links to other pages, even on the same server, and then serve those pages through RunBasic. It looks like RunBasic must produce the links itself, otherwise they won't work.
If I'm wrong, I'd be delighted and I'd also love to know exactly why I'm wrong and how to make RunBasic perform such magic.
If I'm right, has anyone developed a RunBasic application which will serve pre-written web pages including all links?
|
|
|
Post by StefanPendl on Apr 12, 2010 1:19:36 GMT -5
Run BASIC (RB) is a development tool for web applications, it is not a web page builder or HTML editor, like FrontPage and others.
You can include pure HTML code using the HTML command to be able to link to HTML pages or other resources not created via RB.
You can create different RB projects and call one from the other using the RUN command.
|
|
|
Post by Psycho on Apr 12, 2010 17:18:07 GMT -5
As Stefan pointed out, you can create external links using HTML: 'External links served from RunBASIC html "<a href='http://www.cnn.com' target='_new'>CNN</a><br>" html "<a href='http://www.usatoday.com' target='_new'>USA Today</a><br>" html "<a href='http://www.runbasic.com' target='_new'>RunBASIC</a>" John "Psycho" Siejkowski
|
|
|
Post by waybackman on Apr 12, 2010 19:46:39 GMT -5
I already know that RunBasic can serve links if you produce the links using RunBasic itself. That's not a problem.
What I'm asking is, will RunBasic recognise links which it didn't produce in HTML code? For example, if I open an HTML file as a text file, input it to a string and then use the HTML command to send the loaded page to the user, will links embedded within that page still work to cause RunBasic to load further pages saved on the server and if so, how would I code that? Is there an event which could be trapped when the user clicks on a link to cause RunBasic to find the destination file and then load and display it?
I guess what I need is a simple loop which loads and displays a page then waits for the user to click a link before finding the new page and loading and displaying it. I'm presuming this isn't as simple as it sounds, since RunBasic would need to be able to send the user to an external site and (so to speak) exit the loop.
I've used several programming languages including Liberty Basic and I'm pretty good with most of them but like I told you, I'm still a total newbie with RunBasic. :-J I'm still trying to absorb the concepts involved in using RB.
|
|
|
Post by StefanPendl on Apr 13, 2010 3:47:56 GMT -5
Since this is a HTML file, why not create a link to it instead of reading it into a string?
The difference between LB and RB is, that RB already runs in the browser and you use standard browser capabilities to generate your application.
Some things can't be done the way you used them with LB for desktop programming. Web programming is very different in many aspects.
BTW, can you post an example code of what you like to do? Make sure to include a step-by-step explanation how the program should work and what you are expecting.
|
|
|
Post by waybackman on Apr 27, 2010 8:49:58 GMT -5
I have no idea what you mean by "create a link to it instead of reading it into a string".
It seems to me that nobody here can give a straight answer to a simple question. The simple question being, can RB act like a simple web server or not? It seems not. It seems that the only way to make a web page with links work is to read it out of a file into a string, parse the file to find all of the links, then print all of the plain text and add links which RB can "capture" to direct it to the next web page.
If this isn't so, then does RB somehow automatically "know" about links on the page without having to be explicitly told about them?
I'm still confused.
|
|
|
Post by kokenge on Apr 27, 2010 12:38:16 GMT -5
I think it's the old communications problem.. Most of the people here have been doing web applications for a long time and are very knowledgeable. Myself, I started years ago using Java and a few other languages. RB makes it simple, especially since you do not need to do session control. So the frustration works both ways. Anyone here would like to answer you , but ike others I'm having problems understanding the question.. I'll try and answer based on my best understanding of the question. If this is not correct, then let me know where I'm wrong and we can zero in on what you are trying to do. Normally you send clients a web page. This can be done with the HTML or PRINT statement. So if I want to tell them "HELLO" and ask their name it would be somehting like this. ' This sends to the client ' they have the option to send the name or exit
html "HELLO What is you're name" textbox #name,name$,30 button #go, "Send Name", [doName]
html " " button #ex, "Exit", [exit] wait
' this is the tag it goes if they give you their name [doName] name$ = trim$(#name contents$()) html "Thanks ";name$ wait
' this is where it goes when you exit [exit] end
Hope this is a start.
|
|
|
Post by mackrackit on Apr 27, 2010 19:38:04 GMT -5
Yes. Build your site in the public directory. Index page along with any sub directories you need. You can even have an HTML index page as the home page.
|
|
|
Post by waybackman on May 1, 2010 21:04:06 GMT -5
Finally, a straight answer. Thanks mackrackit, but I'm still a bit unclear as to how RB serves the pages. As I understand it, RB expects to run a program (a "project") which you tell it to serve. How do I tell RB to just serve a web page and not run a program to create the web page before serving it?
|
|
|
Post by mackrackit on May 1, 2010 21:18:05 GMT -5
Finally, a straight answer. Thanks mackrackit, but I'm still a bit unclear as to how RB serves the pages. As I understand it, RB expects to run a program (a "project") which you tell it to serve. How do I tell RB to just serve a web page and not run a program to create the web page before serving it? You do not have to tell RB anything, just have the HTML page in the "public" directory and call the page as you would from any server. The "public' directory can be looked at as the "root" directory. Here is an incomplete page still setting in my "public" directory. mackrackit.com:8888/index.htmlNOTE... You will need to copy paste the above address into you address bar because of the way the forum handles links with port numbers. Stefan: corrected URL to be click-able by surrounding it with URL-tags
|
|
|
Post by waybackman on May 4, 2010 3:53:30 GMT -5
Woo! It works!
Thanks, mackrackit. Now I effectively have two web sites. One is from RunBasic and one is made of plain web pages.
Now just one other question.
Is it possible to make RB direct the site visitor directly to a plain HTML page instead of to a running project? Is this as simple as just not serving any projects and naming your home page as index.html?
In other words, I want someone who enters my site URL to see the index.html page instead of being directed to a RunBasic project, without the person having to actually enter the index.html part of the address.
|
|
|
Post by mackrackit on May 4, 2010 8:13:35 GMT -5
Yes, name the home page as index.html. Also, when you do this give the "Login key" a name also. This will be the name of the regular login page for coding and such. Example, if you gave the "Login key" a value of XYZ then mackrackit.com:8888/seaside/go/runbasicpersonal?app=XYZwill take you to your login. (of course use you site name and port number) The nice thing is, if you make a mistake on the preferences just go to the RB root directory and delete the prefs.xml and start over. Or modify the xml.
|
|
|
Post by StefanPendl on May 4, 2010 17:53:40 GMT -5
In the Preferences tab set Home page project name: to the HTML file name of your initial page, e.g. index.html If you leave Login key: empty, then the URL to access the login key would be: http://{your host name}:{your port}/seaside/go/runbasicpersonal?app=login
From the ReadMe of RB:
|
|
|
Post by StefanPendl on May 4, 2010 18:13:13 GMT -5
To automatically redirect to the static page you would have to create a project, I would call it Redirect. The project would include this Code: HomePageURL$ = "http://www.example.com:8008/index.html" head "<meta http-equiv='Refresh' content='5;url="; HomePageURL$; "'>"
print print "You will be redirected to our initial page in 5 seconds!" print print "If redirection fails, please follow this "; html "<a href='"; HomePageURL$; "'>link</a>" print
You would then set that project as the default under Preferences, so any access to your site will end up on the static HTML page.
|
|