heh mam aktualnie coś takiego
<?php
$subpage = $_GET['page'];
$perPage = 5;
{
$subpage = (int) $_GET['subpage'];
}
if ($subpage < 1)
{
$subpage = 1;
}
$start = ($subpage - 1) * $perPage;
AS totality
FROM news ');
$news_results = $results_query['totality'];
$smarty->assign('news_totality',$news_results);
$result = mysql_query("SELECT id, title, author, text, img, date, commnets FROM news
ORDER BY id DESC") or
die("Niepoprawne zapytanie MySQL");
{
$tablica[] = $news;
}
$smarty->assign('result',$tablica);
?>
wszystkie przykłady odnoszą się do czystego php a jak ja mam wszystko to co tam jest zawrzeć w jednej tablicy i wyświetlić to w tpl ?! ;/
Aktualnie mam takie coś teraz nie wiem za bardzo jak to w smarty przedstawić ...
<?php
$subpage = $_GET['page'];
$perPage = 5;
{
$subpage = (int) $_GET['subpage'];
}
if ($subpage < 1)
{
$subpage = 1;
}
$start = ($subpage - 1) * $perPage;
AS totality
FROM news ');
$result = mysql_query("SELECT id, title, author, text, img, date, commnets FROM news
ORDER BY id DESC LIMIT $start, $perPage ") or
die("Niepoprawne zapytanie MySQL");
{
{
$tablica[] = $news;
}
}
$prev = $subpage - 1;
$next = $subpage + 1;
$prevLink = 'index.php?page='.$prev;
$nextLink = 'index.php?page='.$next;
if($subpage > 1)
echo'<a style="text-decoration: none;" href="'.$prevLink.'">Poprzednia strona</a> ';
$stron=round($ilosc_wierszy/$perPage);
for($i=1; $i<=$stron; ++$i)
{
if($i==$subpage)
else
echo '<a style="text-decoration: none;" href="index.php?page='.$i.'">'.$i.' </a>'; }
if($subpage < $stron)
echo ' <a style="text-decoration: none;" href="'.$nextLink.'">Następna strona</a>';
$smarty->assign('result',$tablica);
?>