Difference between revisions of "Xebra Master Pages"

Line 1: Line 1:
 +
===Basics===
 +
 
Xebra Server Pages (.xeb) can be modularized with master pages (or templates). Usually a page has different regions which are dynamic and others which are static. These regions can be modeled with xebra. To illustrate this we use a small example of a page with a static logo and a dynamic content. First we define the static master page (master.xeb):
 
Xebra Server Pages (.xeb) can be modularized with master pages (or templates). Usually a page has different regions which are dynamic and others which are static. These regions can be modeled with xebra. To illustrate this we use a small example of a page with a static logo and a dynamic content. First we define the static master page (master.xeb):
  
Line 43: Line 45:
 
Quite obviously the declared region in master.xeb is filled with the defined region of slave.xeb. Notice that master.xeb will not be transformed to a servlet and will not be accesible from the browser since it is not complete.
 
Quite obviously the declared region in master.xeb is filled with the defined region of slave.xeb. Notice that master.xeb will not be transformed to a servlet and will not be accesible from the browser since it is not complete.
 
Multiple regions can be declared per template. Furthermore including xeb pages can themselves declare new regions or transitively delegate their not implemented regions to their implementors.
 
Multiple regions can be declared per template. Furthermore including xeb pages can themselves declare new regions or transitively delegate their not implemented regions to their implementors.
 +
 +
===Controllers===

Revision as of 09:25, 31 July 2009

Basics

Xebra Server Pages (.xeb) can be modularized with master pages (or templates). Usually a page has different regions which are dynamic and others which are static. These regions can be modeled with xebra. To illustrate this we use a small example of a page with a static logo and a dynamic content. First we define the static master page (master.xeb):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 STRICT//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Foo</title>
</head>
<body>
<img href="logo.gif"/>
<page:declare_region id="dynamic_content" />
</body>
</html>

and a concrete page which includes this master page (slave.xeb):

<page:include template="master">
<page:define_region id="dynamic_content">
Some Content
</page:define_region>
</page:include>

If we compile and display we will get the following page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 STRICT//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Foo</title>
</head>
<body>
<img href="logo.gif"/>
Some Content
</body>
</html>

Quite obviously the declared region in master.xeb is filled with the defined region of slave.xeb. Notice that master.xeb will not be transformed to a servlet and will not be accesible from the browser since it is not complete. Multiple regions can be declared per template. Furthermore including xeb pages can themselves declare new regions or transitively delegate their not implemented regions to their implementors.

Controllers