Witam
w tym topicu jest przykład zastosowanie smarty pod pagera, lecz niewiele mi to mówi bo nigdy nie używałem smarty.
Mam takie pliki
index.php oparty o smarty.
/templates/naglowek.tpl
tabela.php - zwykly plik wyświetlający rekordy z pagerem wer. 2.5
/templates/stopka.tpl
Plik index.php
<?
$_SESSION['user_logged'] = false;
require_once('config.php');
$smarty->display('naglowek.tpl');
// tutaj chciałem stworzyć i wyświetlić tpl z pagerem
$smarty->display('stopka.tpl');
?>
Plik tabela.php wyświetlająca bazę z pagerem.
<?php
require_once('Pager.class.php');
require_once('EPager.class.php');
$orders = array('id','nazwa','ile'); $pager = new EPager('id', null, false,$orders);
$pager->RecordsPerPage = 10;
$sql = 'select * from szukane';
$sql = $pager->Generate($sql);
$headers = array('id' => 'ID', 'nazwa' => 'NAZWA', 'ile' => 'POPULARNOSC'); $pager->OrderHeader($headers);
echo "<table cellpadding='10' cellspacing='6' style='width: 500px'><tr></div> <th><a href=\"{$headers['id']['LINK']}\">ID</a>".($headers['id']['SORTED'] ? ' <img src="sort_'.$headers['id']['SORTED'].'.gif"/>' : '')."</th>
<th><a href=\"{$headers['nazwa']['LINK']}\">NAZWA</a>".($headers['nazwa']['SORTED'] ? ' <img src="sort_'.$headers['nazwa']['SORTED'].'.gif"/>' : '')."</th>
<th><a href=\"{$headers['ile']['LINK']}\">POPULARNOŚĆ</a>".($headers['ile']['SORTED'] ? ' <img src="sort_'.$headers['ile']['SORTED'].'.gif"/>' : '')."</th>
</tr>";
//wyświetlenie wyników zapytania
echo "<tr><td>{$row['id']}</td><td><a href=\"search-mp3,{$row['nazwa']},1.html\" target=\"_blank\">{$row['nazwa']}</a></td><td>{$row['ile']}</td></tr> ";
}
echo '<tr><td colspan="3"><div id="pager">'; echo </div
></td
></tr
></table
> ?>
Dacie mi jakieś wskazówki