Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

How to display multi-dimensional array in two sections? RUS

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: Russian
View previous topic :: View next topic  
Author Message
Stanisov
Smarty n00b


Joined: 09 Apr 2012
Posts: 1

PostPosted: Mon Apr 09, 2012 9:05 am    Post subject: How to display multi-dimensional array in two sections? RUS Reply with quote

Здравствуйте! Нужна помощь новичку!
Нужна помощь с выводом многомерного массива в шаблон
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
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: Russian All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP