SlideShare a Scribd company logo
Ring Documentation, Release 1.5.1
47.9 URL Encode
The Page User Interface
#!c:ringbinring.exe -cgi
Load "weblib.ring"
Import System.Web
New Page
{
boxstart()
text( "URLEncode" )
newline()
boxend()
link([ :url = "ex5.ring?Name="+URLEncode("-*{Mahmoud}*-")+
"&Address=Egypt&Phone=123456&Age=28&Notes=Programmer",
:title = "Test URL Encode" ])
}
Screen Shot:
Screen Shot:
47.9. URL Encode 365
Ring Documentation, Release 1.5.1
47.10 Templates
Using Templates we can write Ring code inside HTML files
Syntax:
<%= Ring Expression %>
<% Ring Statements %>
The HTML Code
<h1>Listing Numbers</h1>
<table>
<tr>
<th> <%= myheader.cColumn1 %> </th>
<th> <%= myheader.cColumn2 %> </th>
<th></th>
<th></th>
<th></th>
</tr>
<% for x in aNumbers %>
<tr>
<td> <%= x.nValue %> </td>
<td> <%= x.nSquare %> </td>
</tr>
<% next %>
</table>
The Ring Code
#!c:ringbinring.exe -cgi
Load "weblib.ring"
Import System.Web
New NumbersController { start() }
47.10. Templates 366
Ring Documentation, Release 1.5.1
Class NumbersController
MyHeader aNumbers
Func Start
MyHeader = New Header
{
cColumn1 = "Number" cColumn2 = "Square"
}
aNumbers = list(20)
for x = 1 to len(aNumbers)
aNumbers[x] = new number
{
nValue = x nSquare = x*x
}
next
cTemp = Template("mynumbers.html",self)
New Page
{
boxstart()
text( "Test Templates" )
newline()
boxend()
html(cTemp)
}
Class Header cColumn1 cColumn2
Class Number nValue nSquare
Screen Shot:
47.10. Templates 367
Ring Documentation, Release 1.5.1
47.11 HTML Special Characters
The text() function display HTML special characters.
If you want to write html code, use the html() function.
47.11. HTML Special Characters 368
Ring Documentation, Release 1.5.1
#!c:ringbinring.exe -cgi
Load "weblib.ring"
Import System.Web
New Page
{
boxstart()
text("HTML Special Characters")
newline()
boxend()
text('
<html>
<body>
<p> "hello world" </p>
</body>
</html>
')
}
Screen Shot:
47.12 Hash Functions
The Page User Interface
#!c:ringbinring.exe -cgi
Load "weblib.ring"
Import System.Web
New Page
{
boxstart()
text( "Hash Test")
newline()
boxend()
divstart([ :style = StyleFloatLeft() + StyleWidth("100px") ])
newline()
text( "Value : " )
newline() newline()
divend()
formpost("ex16.ring")
divstart([ :style = StyleFloatLeft() + StyleWidth("300px") ])
newline()
47.12. Hash Functions 369
Ring Documentation, Release 1.5.1
textbox([ :name = "Value" ])
newline() newline()
submit([ :value = "Send" ])
divend()
formend()
}
Screen Shot:
The Response
#!c:ringbinring.exe -cgi
Load "weblib.ring"
Import System.Web
New Page
{
boxstart()
text( "Hash Result" )
newline()
boxend()
divstart([ :style = styleFloatLeft() + styleWidth("100%") ])
newline()
text( "Value : " + aPageVars["Value"] )
newline()
text( "MD5 : " + MD5(aPageVars["Value"]) )
newline()
text( "SHA1 : " + SHA1(aPageVars["Value"]) )
newline()
text( "SHA256 : " + SHA256(aPageVars["Value"]) )
newline()
text( "SHA224 : " + SHA224(aPageVars["Value"]) )
newline()
text( "SHA384 : " + SHA384(aPageVars["Value"]) )
newline()
text( "SHA512 : " + SHA512(aPageVars["Value"]) )
newline()
divend()
}
Screen Shot:
47.12. Hash Functions 370
Ring Documentation, Release 1.5.1
47.13 Random Image
#!c:ringbinring.exe -cgi
Load "weblib.ring"
Import System.Web
cUploadPath = "C:/Apache2.2/htdocs/ringapp/upload/"
New Page
{
boxstart()
text( "Random Test")
newline()
boxend()
divstart([ :style = styleFloatLeft() + styleWidth("400px") ])
newline()
aList = dir(cUploadPath)
if len(aList) > 0
nIndex = random(len(aList))
if nindex = 0 nIndex = 1 ok
cItem = "upload/" + aList[nIndex][1]
newline()
image( [ :url = cItem , :alt = :image ] )
else
text("No images!") newline()
ok
divend()
}
Screen Shot:
47.13. Random Image 371
Ring Documentation, Release 1.5.1
47.14 HTML Lists
The next example print a list contains numbers from 1 to 10
Then print a list from Ring List.
Finally we have a list of buttons and when we press on a button we get a message contains the clicked button number.
To start the list we uses the ulstart() function.
To end the list we uses the ulend() function.
We uses listart() and liend() to determine the list item.
#!c:ringbinring.exe -cgi
Load "weblib.ring"
Import System.Web
Func Main
New Page
{
ulstart([])
for x = 1 to 10
listart([])
text(x)
liend()
next
ulend()
list2ul(["one","two","three","four","five"])
ulstart([])
for x = 1 to 10
listart([])
47.14. HTML Lists 372
Ring Documentation, Release 1.5.1
cFuncName = "btn"+x+"()"
button([ :onclick = cFuncName , :value = x])
script(scriptfuncalert(cFuncName,string(x)))
liend()
next
ulend()
}
Screen Shot:
47.14. HTML Lists 373
Ring Documentation, Release 1.5.1
47.15 HTML Tables
In this example we will learn how to generate HTML tables using the tablestart(), tableend(), rowstart(), rowend()
,headerstart(), headerend(), cellstart() and cellend() functions.
#!c:ringbinring.exe -cgi
Load "weblib.ring"
Import System.Web
Func Main
New Page
{
divstart([ :style = styledivcenter("400px","500px") ] )
style(styletable() + styletablerows("t01"))
tablestart([ :id = :t01 , :style = stylewidth("100%") ])
rowstart([])
headerstart([]) text("Number") headerend()
headerstart([]) text("square") headerend()
rowend()
for x = 1 to 10
rowstart([])
cellstart([]) text(x) cellend()
cellstart([]) text(x*x) cellend()
rowend()
next
tableend()
divend()
}
Screen Shot:
47.15. HTML Tables 374

More Related Content

What's hot (19)

PDF
The Ring programming language version 1.9 book - Part 49 of 210
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.4 book - Part 41 of 185
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.2 book - Part 29 of 84
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.7 book - Part 45 of 196
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.8 book - Part 47 of 202
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.4.1 book - Part 12 of 31
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.6 book - Part 43 of 189
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.9 book - Part 50 of 210
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.7 book - Part 47 of 196
Mahmoud Samir Fayed
 
PDF
Finch.io - Purely Functional REST API with Finagle
Vladimir Kostyukov
 
PDF
The Ring programming language version 1.4 book - Part 12 of 30
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 52 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.3 book - Part 42 of 184
Mahmoud Samir Fayed
 
PDF
JavaScript ∩ WebAssembly
Tadeu Zagallo
 
PDF
Nativescript angular
Christoffer Noring
 
PDF
The Ring programming language version 1.5.4 book - Part 40 of 185
Mahmoud Samir Fayed
 
PPTX
(Rx).NET' way of async programming (.NET summit 2017 Belarus)
Stas Rivkin
 
PDF
Finch + Finagle OAuth2
Vladimir Kostyukov
 
PDF
The Ring programming language version 1.5.3 book - Part 71 of 184
Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 49 of 210
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 41 of 185
Mahmoud Samir Fayed
 
The Ring programming language version 1.2 book - Part 29 of 84
Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 45 of 196
Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 47 of 202
Mahmoud Samir Fayed
 
The Ring programming language version 1.4.1 book - Part 12 of 31
Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 43 of 189
Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 50 of 210
Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 47 of 196
Mahmoud Samir Fayed
 
Finch.io - Purely Functional REST API with Finagle
Vladimir Kostyukov
 
The Ring programming language version 1.4 book - Part 12 of 30
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 52 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 42 of 184
Mahmoud Samir Fayed
 
JavaScript ∩ WebAssembly
Tadeu Zagallo
 
Nativescript angular
Christoffer Noring
 
The Ring programming language version 1.5.4 book - Part 40 of 185
Mahmoud Samir Fayed
 
(Rx).NET' way of async programming (.NET summit 2017 Belarus)
Stas Rivkin
 
Finch + Finagle OAuth2
Vladimir Kostyukov
 
The Ring programming language version 1.5.3 book - Part 71 of 184
Mahmoud Samir Fayed
 

Similar to The Ring programming language version 1.5.1 book - Part 40 of 180 (18)

PDF
The Ring programming language version 1.5.3 book - Part 51 of 184
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.2 book - Part 30 of 84
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.7 book - Part 48 of 196
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.3 book - Part 52 of 184
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.1 book - Part 42 of 180
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5 book - Part 8 of 31
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.6 book - Part 46 of 189
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.8 book - Part 49 of 202
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.2 book - Part 43 of 181
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.4.1 book - Part 13 of 31
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.3 book - Part 31 of 88
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.9 book - Part 53 of 210
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.2 book - Part 32 of 84
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.3 book - Part 54 of 184
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.3 book - Part 44 of 184
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.2 book - Part 42 of 181
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.8 book - Part 50 of 202
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.7 book - Part 44 of 196
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 51 of 184
Mahmoud Samir Fayed
 
The Ring programming language version 1.2 book - Part 30 of 84
Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 48 of 196
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 52 of 184
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.1 book - Part 42 of 180
Mahmoud Samir Fayed
 
The Ring programming language version 1.5 book - Part 8 of 31
Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 46 of 189
Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 49 of 202
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 43 of 181
Mahmoud Samir Fayed
 
The Ring programming language version 1.4.1 book - Part 13 of 31
Mahmoud Samir Fayed
 
The Ring programming language version 1.3 book - Part 31 of 88
Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 53 of 210
Mahmoud Samir Fayed
 
The Ring programming language version 1.2 book - Part 32 of 84
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 54 of 184
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 44 of 184
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 42 of 181
Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 50 of 202
Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 44 of 196
Mahmoud Samir Fayed
 
Ad

More from Mahmoud Samir Fayed (20)

PDF
The Ring programming language version 1.10 book - Part 212 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 211 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 210 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 208 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 207 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 205 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 206 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 204 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 203 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 202 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 201 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 200 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 199 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 198 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 197 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 196 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 195 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 194 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 193 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 192 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 212 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 211 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 210 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 208 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 207 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 205 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 206 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 204 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 203 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 202 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 201 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 200 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 199 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 198 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 197 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 196 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 195 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 194 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 193 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 192 of 212
Mahmoud Samir Fayed
 
Ad

Recently uploaded (20)

PDF
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
Biography of Daniel Podor.pdf
Daniel Podor
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
Biography of Daniel Podor.pdf
Daniel Podor
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 

The Ring programming language version 1.5.1 book - Part 40 of 180

  • 1. Ring Documentation, Release 1.5.1 47.9 URL Encode The Page User Interface #!c:ringbinring.exe -cgi Load "weblib.ring" Import System.Web New Page { boxstart() text( "URLEncode" ) newline() boxend() link([ :url = "ex5.ring?Name="+URLEncode("-*{Mahmoud}*-")+ "&Address=Egypt&Phone=123456&Age=28&Notes=Programmer", :title = "Test URL Encode" ]) } Screen Shot: Screen Shot: 47.9. URL Encode 365
  • 2. Ring Documentation, Release 1.5.1 47.10 Templates Using Templates we can write Ring code inside HTML files Syntax: <%= Ring Expression %> <% Ring Statements %> The HTML Code <h1>Listing Numbers</h1> <table> <tr> <th> <%= myheader.cColumn1 %> </th> <th> <%= myheader.cColumn2 %> </th> <th></th> <th></th> <th></th> </tr> <% for x in aNumbers %> <tr> <td> <%= x.nValue %> </td> <td> <%= x.nSquare %> </td> </tr> <% next %> </table> The Ring Code #!c:ringbinring.exe -cgi Load "weblib.ring" Import System.Web New NumbersController { start() } 47.10. Templates 366
  • 3. Ring Documentation, Release 1.5.1 Class NumbersController MyHeader aNumbers Func Start MyHeader = New Header { cColumn1 = "Number" cColumn2 = "Square" } aNumbers = list(20) for x = 1 to len(aNumbers) aNumbers[x] = new number { nValue = x nSquare = x*x } next cTemp = Template("mynumbers.html",self) New Page { boxstart() text( "Test Templates" ) newline() boxend() html(cTemp) } Class Header cColumn1 cColumn2 Class Number nValue nSquare Screen Shot: 47.10. Templates 367
  • 4. Ring Documentation, Release 1.5.1 47.11 HTML Special Characters The text() function display HTML special characters. If you want to write html code, use the html() function. 47.11. HTML Special Characters 368
  • 5. Ring Documentation, Release 1.5.1 #!c:ringbinring.exe -cgi Load "weblib.ring" Import System.Web New Page { boxstart() text("HTML Special Characters") newline() boxend() text(' <html> <body> <p> "hello world" </p> </body> </html> ') } Screen Shot: 47.12 Hash Functions The Page User Interface #!c:ringbinring.exe -cgi Load "weblib.ring" Import System.Web New Page { boxstart() text( "Hash Test") newline() boxend() divstart([ :style = StyleFloatLeft() + StyleWidth("100px") ]) newline() text( "Value : " ) newline() newline() divend() formpost("ex16.ring") divstart([ :style = StyleFloatLeft() + StyleWidth("300px") ]) newline() 47.12. Hash Functions 369
  • 6. Ring Documentation, Release 1.5.1 textbox([ :name = "Value" ]) newline() newline() submit([ :value = "Send" ]) divend() formend() } Screen Shot: The Response #!c:ringbinring.exe -cgi Load "weblib.ring" Import System.Web New Page { boxstart() text( "Hash Result" ) newline() boxend() divstart([ :style = styleFloatLeft() + styleWidth("100%") ]) newline() text( "Value : " + aPageVars["Value"] ) newline() text( "MD5 : " + MD5(aPageVars["Value"]) ) newline() text( "SHA1 : " + SHA1(aPageVars["Value"]) ) newline() text( "SHA256 : " + SHA256(aPageVars["Value"]) ) newline() text( "SHA224 : " + SHA224(aPageVars["Value"]) ) newline() text( "SHA384 : " + SHA384(aPageVars["Value"]) ) newline() text( "SHA512 : " + SHA512(aPageVars["Value"]) ) newline() divend() } Screen Shot: 47.12. Hash Functions 370
  • 7. Ring Documentation, Release 1.5.1 47.13 Random Image #!c:ringbinring.exe -cgi Load "weblib.ring" Import System.Web cUploadPath = "C:/Apache2.2/htdocs/ringapp/upload/" New Page { boxstart() text( "Random Test") newline() boxend() divstart([ :style = styleFloatLeft() + styleWidth("400px") ]) newline() aList = dir(cUploadPath) if len(aList) > 0 nIndex = random(len(aList)) if nindex = 0 nIndex = 1 ok cItem = "upload/" + aList[nIndex][1] newline() image( [ :url = cItem , :alt = :image ] ) else text("No images!") newline() ok divend() } Screen Shot: 47.13. Random Image 371
  • 8. Ring Documentation, Release 1.5.1 47.14 HTML Lists The next example print a list contains numbers from 1 to 10 Then print a list from Ring List. Finally we have a list of buttons and when we press on a button we get a message contains the clicked button number. To start the list we uses the ulstart() function. To end the list we uses the ulend() function. We uses listart() and liend() to determine the list item. #!c:ringbinring.exe -cgi Load "weblib.ring" Import System.Web Func Main New Page { ulstart([]) for x = 1 to 10 listart([]) text(x) liend() next ulend() list2ul(["one","two","three","four","five"]) ulstart([]) for x = 1 to 10 listart([]) 47.14. HTML Lists 372
  • 9. Ring Documentation, Release 1.5.1 cFuncName = "btn"+x+"()" button([ :onclick = cFuncName , :value = x]) script(scriptfuncalert(cFuncName,string(x))) liend() next ulend() } Screen Shot: 47.14. HTML Lists 373
  • 10. Ring Documentation, Release 1.5.1 47.15 HTML Tables In this example we will learn how to generate HTML tables using the tablestart(), tableend(), rowstart(), rowend() ,headerstart(), headerend(), cellstart() and cellend() functions. #!c:ringbinring.exe -cgi Load "weblib.ring" Import System.Web Func Main New Page { divstart([ :style = styledivcenter("400px","500px") ] ) style(styletable() + styletablerows("t01")) tablestart([ :id = :t01 , :style = stylewidth("100%") ]) rowstart([]) headerstart([]) text("Number") headerend() headerstart([]) text("square") headerend() rowend() for x = 1 to 10 rowstart([]) cellstart([]) text(x) cellend() cellstart([]) text(x*x) cellend() rowend() next tableend() divend() } Screen Shot: 47.15. HTML Tables 374