Displaying the page
NOTE | This Quick Start chapter only describes templates that use the WTF format. However, note that you can add your own template processors to Woof! as described in Template processor plug-ins. |
Having generated the new sequence, we now need a page to actually display it to the user. The page for this method is automatically generated from its view template app/controllers/views/fibonacci-generate-main.wtf. Currently, that still contains a stub so we will edit it to contain the following template.
% my variable seq <p> The first [llength $seq] numbers in the Fibonacci sequence are: </p> <p> [join $seq ", "] <a href='[request url]'>More</a> </p>
Browsing to the URL will now display the following page:

Refreshing the page or clicking on the More link will generate additional numbers in the sequence.
The corresponding Woof! Template Format (WTF) template shown earlier is quite simple. It is essentially a mixture of display text (including HTML tags) and Tcl command and variable references that are replaced with the corresponding values by the Tcl subst command.
The two things to note in this simple case are:
- The reference to the seq member
variable which is brought into the scope of the template through
the
my variable
declaration. This is required for accessing any variables in the controller object from the template file. - The call to the url method of the request object. which returns the current URL. The request object encapsulates the current client request, various attributes of which can be retrieved through method calls.