blob: 0514b49a22d2dc6bbf23adfeb4b3fe5f5b64353b [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Hello World</title>
<link rel="stylesheet" href="../templates/wondrous/styles.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="header">
<h1><a href="../index.html">Rivet</a></h1>
<h2 id="slogan">Webscripting for Tcl'ers</h2>
<div class="clear"></div>
</div>
<div id="body">
<div id="content">
<h2>Hello World</h2>
<div class="example">
<!-- p class="title"><b>Example 1. Hello World</b></p-->
<div class="example-contents">
<p>
As with any tool, it's always nice to see something work, so
let's create a small "Hello World" page.
</p>
<p>
Assuming you have Apache configured correctly, create a file
called <code class="filename">hello.rvt</code>
where Apache can find
it, with the following content:
</p>
<pre class="programlisting">&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Hello World&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;pre&gt;
&lt;b&gt;&lt;? puts "Hello world" ?&gt;&lt;/b&gt;
&lt;/pre&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p>
The example can be elaborated, for example using the <tt>
<a href="http://tcl.apache.org/rivet/manual2.1/html.html">html</a>
</tt>
command
<pre class="programlisting">&lt;? set hello_message "Hello world" ?&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;&lt;? puts $hello_message ?&gt;&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;&lt;?
puts [::rivet::html $hello_message pre b]
?&gt;&lt;/body&gt;
&lt;/html&gt;</pre>
</p>
<p>
Starting with version 2.0.5 Rivet also supports a shorthand notation
to output simple strings.
</p>
<p>
<pre class="programlisting">&lt;? set hello_message "Hello world" ?&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;&lt;?= $hello_message ?&gt;&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;&lt;?= [::rivet::html $hello_message pre b] ?&gt;&lt;/body&gt;
&lt;/html&gt;</pre>
</p>
</div>
</div>
<div class="contentbottom">
<div id="last_modified">Last Modified: 26-11-2018 17:48:19 UTC</div>
</div>
</div>
<div class="sidebar">
<ul>
<li id="tclstuff">
<h4>Rivet &amp; Tcl</h4>
<ul class="blocklist">
<li class="navitem">
<a class="navitem" title="The Rivet development team" href="about.html">About Us - Contact</a>
</li>
<li class="navitem">
<a class="navitem" title="Home of Apache Tcl related stuff" target="asf" href="http://tcl.apache.org/">Apache Tcl Home</a>
</li>
<li class="navitem">
<a class="extern" title="The Tcl Developer Xchange" target="tclxchange" href="http://www.tcl.tk/">The Tcl/Tk Language</a>
</li>
<li class="navitem">
<a class="extern" title="Tcl community wiki site" target="tclwiki" href="http://wiki.tcl.tk/">Tcl'ers Wiki</a>
</li>
</ul>
</li>
<li id="rivetstuff">
<h4>Getting Rivet to Work</h4>
<ul class="blocklist">
<li class="navitem">
<a class="navitem" title="Getting Rivet" href="download.html">Getting Rivet</a>
</li>
<li class="navitem">
<a class="navitem" title="Release Notes" href="release%2dnotes.html">Release Notes</a>
</li>
<li class="navitem">
<a class="extern" title="Apache Rivet Bugzilla" href="https://issues.apache.org/bugzilla/buglist.cgi?quicksearch=Rivet">Bug Reports</a>
</li>
</ul>
</li>
<li id="documentation">
<h4>Documentation</h4>
<ul class="blocklist">
<li class="navitem">
<a class="navitem" title="Examples" href="hello%5fworld.html">Examples</a>
</li>
<li class="navitem">
<a class="navitem" title="Manuals" href="manuals.html">Manuals</a>
</li>
</ul>
</li>
</ul>
<ul>
<li id="rivetexamples">
<h4>Examples</h4>
<ul class="blocklist">
<li class="navitem">
<a class="navitem" title="Hello world!" href="hello%5fworld.html">Hello world!</a>
</li>
<li class="navitem">
<a class="navitem" title="A colorful table" href="colorful%5ftable.html">A colorful table</a>
</li>
<li class="navitem">
<a class="navitem" title="Variable Access" href="var%5faccess.html">Variable Access</a>
</li>
<li class="navitem">
<a class="navitem" title="File Upload" href="file%5fupload.html">File Upload</a>
</li>
<li class="navitem">
<a class="navitem" title="File Download" href="file%5fdownload.html">File Download</a>
</li>
<li class="navitem">
<a class="navitem" title="XML and Ajax" href="ajax.html">XML and Ajax</a>
</li>
<li class="navitem">
<a class="navitem" title="Calendar" href="calendar.html">Calendar</a>
</li>
</ul>
</li>
</ul>
<ul>
</ul>
</div>
<div class="clear"></div>
</div>
</div>
<div id="footer">
<div class="footer-content">
<p><a href="http://www.apache.org/">Apache Software Foundation</a> | Design by <a href="http://www.spyka.net">Free CSS Templates</a> | <a href="http://www.justfreetemplates.com">Free Web Templates</a></p>
</div>
</div>
<div style="text-align: center; font-size: 0.75em;">Design downloaded from <a href="http://www.freewebtemplates.com/">free website templates</a>.</div></body>
</html>