*/
function render(&$template) // ~X2C
{
- $template->loadTemplateFile('bife_album.html');
+ $template->group = 'album';
$root = $this->attrs['DIR'];
$list = $this->getList();
$tot = count($list);
$rows = ceil($tot / $this->attrs['COLUMNS']);
+ $html_rows = '';
for ($row = 0; $row < $rows; $row++) {
+ $html_cells = '';
for ($col = 0; $col < $this->attrs['COLUMNS']; $col++) {
$cur = $row * $this->attrs['COLUMNS'] + $col;
if ($photo = @$list[$cur]) {
// FIXME - Si no se pudo crear el thumb, devuelve null
// (ver si se agrega otro template para indicar error
// o algo asi).
- $photo['URL'] = $this->attrs['LINK-URL'] . '?BIFE_ALBUM_FILE=' .
- urlencode($photo['FILE']);
+ $photo['URL'] = $this->attrs['LINK-URL'] .
+ '?BIFE_ALBUM_FILE=' . urlencode($photo['FILE']);
if ($this->attrs['LINK-BIFE']) {
- $photo['URL'] .= '&BIFE=' . urlencode($this->attrs['LINK-BIFE']);
+ $photo['URL'] .= '&BIFE=' .
+ urlencode($this->attrs['LINK-BIFE']);
}
- $template->setVariable($photo);
- $template->parse('ITEM');
+ $html_cell = $template->parse('item', $photo);
} else {
- $template->touchBlock('EMPTY');
- $template->parse('EMPTY');
+ $html_cell = $template->parse('empty');
}
+ $html_cells .= $template->parse('cell', 'CONTENTS', $html_cell);
}
- $template->parse('ROW');
+ $html_rows .= $template->parse('row', 'CONTENTS', $html_cells);
}
- $template->setVariable('DESC', $this->getDescription());
- return $template->get();
+ return $template->parse(
+ 'body',
+ array('DESC' => $this->getDescription(), 'CONTENTS' => $html_rows));
}
// -X2C
if (is_readable("$root/$file") and in_array($ext, $exts)) {
$thumb = $this->getThumbFilename("$root/$file");
$return[] = array(
- 'FILE' => "$root/$name",
+ 'FILE' => "$root/$file",
'DESC' => $name,
'THUMB' => is_readable($thumb) ? $thumb : null,
);