Witam Serdecznie
mam taki problem ze smarty raczej:
<?php for($i = 0;$i<=http://www.php.net/floor(($iloscWpisow-1)/NEWS_NA_STRONIE);$i++){ $stron = http://www.php.net/array( $stron_wynik => $i, $stron_plus => $i+1 ); } $smarty->assign("stron",$stron); $smarty->display("news_sort.tpl"); ?>
<http://december.com/html/4/element/table.html> <http://december.com/html/4/element/tr.html> <http://december.com/html/4/element/td.html>Stron :</http://december.com/html/4/element/td.html><http://december.com/html/4/element/td.html> {foreach item=stron from=stron} <http://december.com/html/4/element/a.html href="news.php?limit_news={$stron.stron_wynik}">{$stron.stron_plus}</http://december.com/html/4/element/a.html></http://december.com/html/4/element/td.html> {/foreach} </http://december.com/html/4/element/tr.html> </http://december.com/html/4/element/table.html>
<?php for($i = 0;$i<=http://www.php.net/floor(($iloscWpisow-1)/NEWS_NA_STRONIE);$i++){ $stron = http://www.php.net/array( $stron_wynik => $i, $stron_plus => $i+1 ); } $smarty->assign("stron",$stron); $smarty->display("news_sort.tpl"); ?>
nadal mi wyskakuje "s" zamiast 1,2,3,4,...
a wystarczy ze w php wsatwie
<?php http://www.php.net/echo($i+1); ?>
Daj pod petla for
<?php http://www.php.net/echo '<pre>'; http://www.php.net/print_r($stron); ?>
to cos smarty nie przerabia tego
{foreach item=stron1 from=$stron} <http://december.com/html/4/element/a.html href="news.php?limit_news={$stron1.stron_wynik}">{$stron1.stron_plus}</http://december.com/html/4/element/a.html></http://december.com/html/4/element/td.html> {/foreach}
po pierwsze dodajemy kolejne rekordy a więc przy przypisaniu do tablicy numerycznej nie $stron a $stron[] a w smarty
{foreach from=$stron item='str'} <http://december.com/html/4/element/a.html href="news.php?limit_news={$str.stron_wynik}">{$str.stron_plus}</http://december.com/html/4/element/a.html></http://december.com/html/4/element/td.html> {/foreach}
katastrofa "s" chyba {/foreach} w smarty sie gryzie z for(){};
tylko jak zrobic petle w smarty / lub wyswietlic wiele wynikow nie uzywajac jej lol
Przecież w pętli za każdym razem nadpisujesz tablicę $stron, w wyniku czego będzie to tylko ta "ostatnia" tablica.
nie $stron a $stron[]
W Smartach chcesz trzaskać 2 pętle for (jak rozumiem phpowe) oraz jeszcze foreach (smartowe)? No to gratuluję pomysłowości. Przedstaw lepiej dokładnie problem bo po takich ogólnikach to można tylko ręce załamać.
PS: i olej Smarty na rzecz standardowego "systemu szablonów" czyli:
<ul> <?php for($i=1; $i<=10; $i++): ?> <li><?= $i ?></li> <?php endfor; ?> </ul>
Patrz uważnie
<?php for($i = 0;$i<=http://www.php.net/floor(($iloscWpisow-1)/NEWS_NA_STRONIE);$i++){ http://www.php.net/echo($i+1); $stron = http://www.php.net/array( 'stron_wynik' => ($i), 'stron_plus' => ($i+1) ); } ?>
<http://december.com/html/4/element/table.html> <http://december.com/html/4/element/tr.html> <http://december.com/html/4/element/td.html>Stron :</http://december.com/html/4/element/td.html><http://december.com/html/4/element/td.html> <http://december.com/html/4/element/a.html href="news.php?limit_news={$stron.stron_wynik}">{$stron.stron_plus}</http://december.com/html/4/element/a.html></http://december.com/html/4/element/td.html> </http://december.com/html/4/element/tr.html> </http://december.com/html/4/element/table.html>
Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)