This document describes uploading files in Ring and provides code examples. It contains two sections - the page user interface and the response. The page user interface section shows code for a form to upload multiple files and collect customer name. The response section shows code to process the uploaded files, save them to a folder, and display the uploaded file names and a download link.
7. Ring Documentation, Release 1.10
53.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
#!ring -cgi
Load "weblib.ring"
Import System.Web
New NumbersController { start() }
53.10. Templates 474
8. Ring Documentation, Release 1.10
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:
53.10. Templates 475
9. Ring Documentation, Release 1.10
53.11 HTML Special Characters
The text() function display HTML special characters.
If you want to write html code, use the html() function.
53.11. HTML Special Characters 476