3.5 :: Link WAPL pages together

Links in WAPL


Links allow users to navigate from one page to another.
  1.  <?xml version="1.0" encoding="UTF-8" ?>
  2.  <wapl xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://wapl.wapple.net/wapl.xsd">
  3.   <head>
  4.   <title>My First WAPL</title>
  5.   </head>
  6.   <layout>
  7.   <easyExternalImage filetype="png" scale="50">
  8.   <url>http://wapl.info/img/logo.png</url>
  9.   </easyExternalImage>
  10.   <easyChars>
  11.   <value>Hello World</value>
  12.   </easyChars>
  13.   <easyLink>
  14.   <label>Click me</label>
  15.   <url>http://wapl.info/files/examples/wapl_is_easy.xml</url>
  16.   </easyLink>
  17.   </layout>
  18.  </wapl>
Downloadlisting 3.5.a

easyLink element


Like other easy elements, easyLinks are quick, but a bit limited in what they can do.
Our easyLink element is positioned at the bottom of our page, making it the last child of <layout>.
..snip..
  1.   <layout>
  2.   <easyExternalImage filetype="png" scale="50">
  3.   <url>http://wapl.info/img/logo.png</url>
  4.   </easyExternalImage>
  5.   <easyChars>
  6.   <value>Hello World</value>
  7.   </easyChars>
  8.   <easyLink>
  9.   <label>Click me</label>
  10.   <url>http://wapl.info/files/examples/wapl_is_easy.xml</url>
  11.   </easyLink>
  12.   </layout>
..snip..

What does it say?


Your <easyLink> element needs a label. This will be the clickable text of the link.
..snip..
  1.   <easyLink>
  2.   <label>Click me</label>
  3.   <url>http://wapl.info/files/examples/wapl_is_easy.xml</url>
  4.   </easyLink>
..snip..

This example will show clear instructions: 'Click Me'.

Set your destination


<easyLink> elements need a url to link to. This should be an absolute url to another WAPL document, accessible through http.
..snip..
  1.   <easyLink>
  2.   <label>Click me</label>
  3.   <url>http://wapl.info/files/examples/wapl_is_easy.xml</url>
  4.   </easyLink>
..snip..

This is the WAPL file that we're linking to. It contains a link back to the first page.
  1.  <?xml version="1.0" encoding="UTF-8" ?>
  2.  <wapl xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://wapl.wapple.net/wapl.xsd">
  3.   <head>
  4.   <title>My Second WAPL</title>
  5.   </head>
  6.   <layout>
  7.   <easyChars>
  8.   <value>Wow! WAPL is easy. Well done, you've taken your first steps into a wider world.</value>
  9.   </easyChars>
  10.   <easyLink>
  11.   <label>Show me that cool page again</label>
  12.   <url>http://wapl.info/files/examples/hello_world_4.xml</url>
  13.   </easyLink>
  14.   </layout>
  15.  </wapl>
Downloadlisting 3.5.b

Notice that once again the url is absolute.

Contents