|
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 |
Stanisov Smarty n00b
Joined: 09 Apr 2012 Posts: 1
|
Posted: Mon Apr 09, 2012 9:05 am Post subject: How to display multi-dimensional array in two sections? RUS |
|
|
Здравствуйте! Нужна помощь новичку!
Нужна помощь с выводом многомерного массива в шаблон
Code: |
<?php
$arr[0] = array('id' => '0', 'title' => 'Заголовок0', 'desc' => 'Описание0', 'price' => '300');
$arr[1] = array('id' => '1', 'title' => 'Заголовок1', 'desc' => 'Описание1', 'price' => '300');
$arr[2] = array('id' => '2', 'title' => 'Заголовок2', 'desc' => 'Описание2', 'price' => '300');
$arr[3] = array('id' => '3', 'title' => 'Заголовок3', 'desc' => 'Описание3', 'price' => '300');
...
?>
|
В шаблоне Smarty tpl нужно выводить в 2х секциях по 10 элементов:
Code: |
<ul class="attr">
<li><span class="niceCheck" onclick="changeCheck(this.id)" id="niceCheckbox{$arr.id}" rel="{$arr.desc}"><input type="checkbox" id="choise{$arr.id}" class="clickChecked" name="choise[]" value="{$arr.price}" /> <label for="choise[{$arr.id}]">{$arr.title}</label></span></li>
</ul>
|
и далее вторая секция с 10ю элементами, выводится таким же образом
Code: |
<ul class="attr">
<li><span class="niceCheck" onclick="changeCheck(this.id)" id="niceCheckbox{$arr.id}" rel="{$arr.desc}"><input type="checkbox" id="choise{$arr.id}" class="clickChecked" name="choise[]" value="{$arr.price}" /> <label for="choise[{$arr.id}]">{$arr.title}</label></span></li>
</ul>
|
|
|
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
|