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:
my variable declaration. This is required
for accessing any variables in the controller object from the template
file.
Woof! Version: 0.4, Server: Apache, Interface: CGI, Tcl: 8.6b1.1