showTemplate

(Since 1.2.0) -- style Pod rows
function showTemplate($tpl, $code = null)
The showTemplate function takes each returned item from your Pod class and wraps them in your template of choice.
<?php
// Initialize the pod
$pods = new Pod('pod_name');
 
// Find items in that pod
$pods->findRecords('id DESC', 15);
 
// Use the template named "item_listing" for each item found
echo $pods->showTemplate('item_listing');
?>

Parameters

ParameterTypeDetails
$tpl STRING the name of the template you want to use
$code STRING (optional) use custom code instead of an existing template

Examples

Add Pod Items You have a pod called “event” with the following items:
idnamedate
1First Event2009-06-02 10:30:00
2Second Event2008-02-12 18:00:00
3Third Event2008-05-20 04:30:00
Create Pod Template You have a template called "event_list" with the following code:
{@date}
Setup Pod Page In a new Pod Page (called "events", for example), you can display this item listing. For this example, we'll sort the items in descending order by date.
<?php
$pods = new Pod('event');
$pods->findRecords('date DESC', 25);
echo $pods->showTemplate('event_list');
?>
And the Final Output...
2009-06-02 10:30:00
2008-05-20 04:30:00
2008-02-12 18:00:00