The table below shows a simple LIVE v-creator example in action.
| Title | Author | ISBN |
|---|---|---|
| Cascading Style Sheets: The Definitive Guide, 2nd Edition | Eric Meyer | 0-596-00525-3 |
| Essential CVS | Jennifer Vesperman | 0-596-00459-1 |
| HTML & XHTML: The Definitive Guide, 5th Edition | Chuck Musciano, Bill Kennedy | 0-596-00382-X |
| Learning PHP 5 | David Sklar | 0-596-00560-1 |
| Learning the vi Editor, 6th Edition | Linda Lamb, Arnold Robbins | 1-56592-426-6 |
| Programming PHP | Rasmus Lerdorf, Kevin Tatroe | 1-56592-610-2 |
| Understanding the Linux Kernel, 2nd Edition | Daniel P. Bovet, Marco Cesati | 0-596-00213-0 |
The example was created using an automatically generated database module. The figure below shows the steps to creating the module.
To generate the above table the following HTML & v-creator tags were used:
<table>
<tr>
<th>Title<th>
<th>Author<th>
<th>ISBN<th>
<tr>
|{LOOP:books}|
<tr |{COND:odd_row}|style="background: #dfdfdf;"|{CEND}|>
<td>|{DATA:book_title}|<td>
<td>|{DATA:author}|<td>
<td>|{DATA:isbn}|<td>
<tr>
|{LEND}|
<table>
We can now reuse the book module to produce other dynamic elements.
Or lists of data:
<ul>
|{book_id=VC_NULL}|
|{LOOP:books}|
<li>|{DATA:book_author}|</li>
|{LEND}|
</ul>
v-creator also makes it easy to have content displayed based on conditional tests. As the books module has an odd/even flag it will be used to demonstrate conditional testing by only showing books from even database rows:
<ul>
|{book_id=VC_NULL}|
|{LOOP:books}|
|{COND:odd_row}|
<li>|{DATA:book_author}|</li>
|{CEND}|
|{LEND}|
</ul>