I'm creating a Joomla! component with patTemplate. When I want to show a list with a condition, the template only execute the condition for the first row.
Code: Select all
<mos:tmpl name="view">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<mos:tmpl name="rows">
<tr>
<th width="15%" align="left">Título:</th>
<td width="85%">{ROW_TITLE} (# {ROW_ID}) </td>
</tr>
<tr>
<th align="left">Categoría:</th>
<td>{ROW_CATID}</td>
</tr>
<tr>
<th align="left">Prioridad:</th>
<td>{ROW_LEVEL}</td>
</tr>
<tr>
<th align="left">Estado:</th>
<td>{ROW_STATUS}</td>
</tr>
<tr>
<th align="left">Publicado:</th>
<td>{ROW_INDATE}</td>
</tr>
<tr>
<th align="left">Mensaje:</th>
<td>{ROW_DESCRIPTION}</td>
</tr>
<mos:tmpl name="options" type="condition" conditionvar="options">
<mos:sub condition="0">
<tr>
<td colspan="2"><a href="index.php?option=com_debug&task=reply&id={ROW_ID}">Responder</a></td>
</tr>
</mos:sub>
<mos:sub condition="1">
<tr>
<td colspan="2"><a href="index.php?option=com_debug&task=reply&id={ROW_ID}">Responder</a> | <a href="index.php?option=com_debug&task=level&id={ROW_ID}">Cambiar prioridad</a> | <a href="index.php?option=com_debug&task=status&id={ROW_ID}">Cambiar estado</a> | <a href="index.php?option=com_debug&task=delete&id={ROW_ID}">Eliminar</a> </td>
</tr>
</mos:sub>
</mos:tmpl>
</mos:tmpl>
</table>
</mos:tmpl>
Code: Select all
function view( $id ) {
global $database, $my;
// import the body of the page
$tmpl =& debugHTML::createTemplate();
$query = "SELECT * FROM #__debug_incidents WHERE id = $id OR parentid = $id ORDER BY indate";
// prepare the query in the database connector
$database->setQuery( $query );
// retrieve the rows as objects
$rows = $database->loadObjectList();
// DISPLAY DATA
// load the template based on the selected skin
$tmpl->readTemplatesFromInput( 'view.html' );
// add the 'rows' to the rows template with a prefix
$tmpl->addObject( 'rows', $rows, 'row_' );
if( $my->gid == 2 ) {
$tmpl->addVar('options', 'OPTIONS', 1);
}
else {
$tmpl->addVar('options', 'OPTIONS', 0);
}
// output the template
$tmpl->displayParsedTemplate( 'view' );
}
I'm new with patTemplate, where can I found more information? I read some threads about patTemplate, but I prefer to start with the most basic information.