The document provides documentation on using Ring for web development, including instructions on setting up a web server to run Ring applications, and examples of writing simple "Hello World" programs using Ring's built-in web library and features like handling HTTP GET and POST requests, uploading files, and using templates. It also includes screenshots of example programs.
Night 7k to 12k Daman Call Girls đđ 8617697112ââ 100% Genuine Escort Service ...
Â
The Ring programming language version 1.7 book - Part 44 of 196
1. Ring Documentation, Release 1.7
Run/Start the server
Create your web applications in a directory supported by the web server.
Example:
Apache2.2htdocsmywebapplicationfolder
Example:
xampphtdocsmywebapplicationfolder
Inside the source code ïŹle (*.ring), Add this line
#!ring -cgi
Note: Change the previous line based on the path to ring.exe in your machine
49.2 Ring CGI Hello World Program
The next program is the Hello World program
#!ring -cgi
See "content-type : text/html" +nl+nl+
"Hello World!" + nl
49.3 Hello World Program using the Web Library
We can use the web library to write CGI Web applications quickly
Example (1) :
#!ring -cgi
Load "weblib.ring"
Import System.Web
New Page
{
Text("Hello World!")
}
Example (2) :
#!ring -cgi
Load "weblib.ring"
Import System.Web
WebPage()
{
Text("Hello World!")
}
49.2. Ring CGI Hello World Program 402
2. Ring Documentation, Release 1.7
Tip: the difference between ex. 1 and ex. 2 is using WebPage() function to return the page object instead of creating
the object using new statement.
49.4 Web Library Features
The next features are provided by the Web library to quickly create web applications.
âą Generate HTML pages using functions
âą Generate HTML pages using objects
âą HTTP Get
âą HTTP Post
âą Files Upload
âą URL Encode
âą Templates
âą CRUD MVC Sample
âą Users Logic & Registration Sample
49.5 HTTP Get Example
The Page User Interface
#!ring -cgi
Load "weblib.ring"
Import System.Web
New Page
{
Title = "Test HTTP Get"
divstart([ :style = StyleSizeFull() ] )
boxstart()
text( "Test HTTP GET" )
newline()
boxend()
divstart([ :style = Styledivcenter("600px","550px") +
StyleGradient(21) ])
divstart([:style = stylefloatleft() + stylesize("100px","100%") +
stylecolor("black") + stylegradient(58)])
formstart("ex5.ring")
tablestart([ :style = stylesize("65%","90%") +
stylemarginleft("35%") +
stylemargintop("30%") ])
rowstart([])
cellstart([])
text ( "Name : " )
cellend()
cellstart([])
cTextboxStyle = StyleMarginLeft("5%") +
StyleWidth("250px") +
StyleColor("black") +
49.4. Web Library Features 403