Skip to content

ZedSeries Listing: How to use helper in template writing

October 26, 2009

ZedSeries Listing set a template variable named fh that can be used for  better customize our listing template.

A little example for clarifying how the help can be used:

For the following example we assume that we are querying the pageTitle,language and tstamp fields from tl_page to show some pages of our website with creation date.

<div<?php echo $this->cssID; ?>
<?php if ($this->style): ?>
style="<?php echo $this->style; ?>"
<?php endif; ?>>
<?php foreach ($this->tbody as $class=>$row): ?>
<p>
<small><?php echo $this->thead[$this->fh->pageTitle]['link']; ?></small>:
<?php echo $row[$this->fh->pageTitle]['content']; ?>
</p>
<p>
<small>Created on</small>:
<?php echo date("Y-m-d H:i:s", $row[$this->fh->tstamp]['raw']); ?>
</p>
<hr />
<?php endforeach; ?>
</div>

As shown above we can use $this->fh->%fieldname% to refer to our fields: so we can displays them without worrying about select order.

Leave a comment