|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
IceJOKER Smarty n00b
Joined: 08 Jul 2014 Posts: 2
|
Posted: Tue Jul 08, 2014 2:27 pm Post subject: Vopros pro smarty {section} | Question about {section} |
|
|
Есть переменные:
$items //массив с данными(для примера пускай там значения от 0 до 55)
нужно пробежаться по этому массиву и вывести данные в таком виде:
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
</ul>
<ul>
<li>6</li>
<li>7</li>
<li>8</li>
<li>9</li>
<li>10</li>
</ul>
.......
никак не могу разобраться с {section} smarty
на php сморозил что-то типа этого
<?php
$items = range(0, 27);
$count = count($items);
$pages = ceil($count/5);
for($i = 0, $k=1; $i <= $pages; $i++){
echo '<ul>';
for($j = 1; $j <= 5; $j++, $k++){
if(!isset($items[$k])) break 2;
echo '<li>'.$items[$k].'</li>';
}
echo '</ul>';
} |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|