如何查询数组使用到jquery ui标签?

时间:2013-09-12 18:13:31

标签: codeigniter

http://sphotos-h.ak.fbcdn.net/hphotos-ak-prn2/v/1291812_726798364014050_1048588136_n.jpg?oh=a3d67e861bd9932a6a19e57819d2baa2&oe=5233F729&__gda__=1379199229_33f351e1d3876f61503ffe0097f059eb

我想查询数组:

Array ( [0] => Array 
( [0] => Array ([cid] => 12 [sid] => 1 [category_name] => กาแฟ [mid] => 7 [menu_name] => เอสเพรสโซ่ (ร้อน) [price] => 50 )
 [1] => Array ( [cid] => 12 [sid] => 1 [category_name] => กาแฟ [mid] => 9 [menu_name] => มอคค่า (ร้อน) [price] => 50 )
)
 [1] =>Array ( [0]=> Array ( [cid] => 14 [sid] => 1 [category_name] => โกโก้ & ชา [mid] => 8 [menu_name] => โกโก้ (เย็น) [price] => 60 )

 ) 

1 个答案:

答案 0 :(得分:1)

我不确定你的意思,但我相信你试图从数组中获取数据以插入ui标签。这就是我在MVC中要做的事情:

查看:

<li class="tab" id=""><a href="#<?php echo $variable; ?>">Test</a></li>
<li class="tab" id=""><a href="#<?php echo $variable; ?>">Test</a></li>
<li class="tab" id=""><a href="#<?php echo $variable; ?>">Test</a></li>
<li class="tab" id=""><a href="#<?php echo $variable; ?>">Test</a></li>
<li class="tab" id=""><a href="#<?php echo $variable; ?>">Test</a></li>

控制器:

function expand_staff_info($staff_info) {
   $data = $this->Model_request->getData();
   $this->load->view('agents/view_staff_info', $data);
}

型号:

 function getData() {
  $array = array(..... YOUR ARRAY ......);
  $data;
   foreach ($array as $row) {
     foreach ($row as $key => $val) {
        $data[$key] = $val;
     }
   }
  return $data;
}