cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From da...@cocoon.zones.apache.org
Subject [DAISY] Updated: Advanced Control Flow - Tutorial
Date Fri, 14 Oct 2005 13:20:35 GMT
A document has been updated:

http://cocoon.zones.apache.org/daisy/legacydocs/520.html

Document ID: 520
Branch: main
Language: default
Name: Advanced Control Flow - Tutorial (previously Advanced Control Flow)
Document Type: Document (unchanged)
Updated on: 10/14/05 1:20:28 PM
Updated by: Helma van der Linden

A new version has been created, state: publish

Parts
=====
Content
-------
This part has been updated.
Mime type: text/xml (unchanged)
File name:  (unchanged)
Size: 11328 bytes (previous version: 11336 bytes)
Content diff:
(11 equal lines skipped)
    
    <p>Create the following <tt>sitemap.xmap</tt> in the new subdirectory:</p>
    
--- <pre>
--- &lt;?xml version="1.0" encoding="UTF-8"?&gt;
+++ <pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
    &lt;map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0"&gt;
    
    &lt;map:components&gt;
(81 equal lines skipped)
    the player. Create the file <tt>guess.jx</tt>, which will be the page the
player
    will enter their guess:</p>
    
--- <pre>
--- &lt;?xml version="1.0"?&gt;
+++ <pre>&lt;?xml version="1.0"?&gt;
    &lt;html xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"&gt;
    &lt;head&gt;
      &lt;title&gt;cocoon flow number guessing game&lt;/title&gt;
(13 equal lines skipped)
    <p>You'll also need a page to display when the person chooses the correct
    number. Name it <tt>success.jx</tt> (Again in <tt>documents/</tt>):</p>
    
--- <pre>
--- &lt;?xml version="1.0"?&gt;
+++ <pre>&lt;?xml version="1.0"?&gt;
    &lt;html xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"&gt;
    &lt;head&gt;
      &lt;title&gt;cocoon flow number guessing game&lt;/title&gt;
(18 equal lines skipped)
    
    <p>Create the following file named <tt>game.js</tt>:</p>
    
--- <pre>
--- function main() {
+++ <pre>function main() {
    
      var random =  Math.round( Math.random() * 9 ) + 1;
    
(43 equal lines skipped)
    
    <p>We now get to the following line, where things start to get interesting:</p>
    
--- <pre>
--- cocoon.sendPageAndWait("guess.jxt", { "random" : random, "hint" : hint, "guesses" : guesses}
);
+++ <pre>cocoon.sendPageAndWait("guess.jxt", { "random" : random, "hint" : hint, "guesses"
: guesses} );
    </pre>
    
    <p>The Flow layer sends the contents of the URI "guess.jx" which is matched in
(5 equal lines skipped)
    
    <p>We could also do the following:</p>
    
--- <pre>
--- cocoon.sendPageAndWait("guess.jx", { "foo" : random } );
+++ <pre>cocoon.sendPageAndWait("guess.jx", { "foo" : random } );
    </pre>
    
    <p>In this case, the value of random would be able to be substituted in our
(16 equal lines skipped)
    <p>One thing to note is in the form which is sent back to Cocoon when the player
    submits the guess:</p>
    
--- <pre>
--- &lt;form method="post" action="${cocoon.continuation.id}.kont"&gt;
+++ <pre>&lt;form method="post" action="${cocoon.continuation.id}.kont"&gt;
    </pre>
    
    <p>Here, ${cocoon.continuation.id} is resolved to a unique identifier which
(4 equal lines skipped)
    contains the continuation ID, plus ".kont", which we end up matching in the
    sitemap:</p>
    
--- <pre>
--- &lt;map:match pattern="*.kont"&gt;
+++ <pre>&lt;map:match pattern="*.kont"&gt;
      &lt;map:call continuation="{1}"/&gt;
    &lt;/map:match&gt;
    </pre>
(45 equal lines skipped)


Fields
======
no changes

Links
=====
no changes

Custom Fields
=============
no changes

Collections
===========
no changes

Mime
View raw message