-
Notifications
You must be signed in to change notification settings - Fork 16
Nesting of blocks
Rosario Carvello edited this page Feb 4, 2018
·
35 revisions
There are two general purposes of using the nesting of blocks:
- To show a set of different values when each value, in turn, contains a set of shared values
- To show a set of different values when each value, in turn, contains a set of custom values
We start by showing you the following templates\nested_blocks.html.tpl
<!DOCTYPE html>
<html>
<head>
<title>Users list</title>
</head>
<body>
<h1>Users list</h1>
{CurrentAction}
<table border="1">
<thead>
<tr>
<th>User</th>
<th>Email</th>
<th>Actions</th>
<tr>
</thead>
<tbody>
<!-- BEGIN Users -->
<tr>
<td>{UserName}</td>
<td>{UserEmail}</td>
<td>
<ul>
<!-- BEGIN UserActions -->
<li><a href="nested_blocks/do_action/{ActionName}/{UserEmail}">{ActionName}</a> </li>
<!-- END UserActions -->
</ul>
</td>
</tr>
<!-- END Users -->
</tbody>
</table>
</body>
</html>
As you can guess from the code above the purpose of this template is to representing the static structure of a table of users and to show, for each user, a set of links for emailing, editing or deleting a user. In fact, we nested the block UserActions
inside the block Users
. Then we designed inside UserActions
the static representation of an unnumbered list of actions links. Note that we coded only the static representation of an action link by representing a call to doAction()
method and by passing it the action name and the user email.
// TODO