0
我想構建一個摺疊列表,並且該數據列表來自我的數據庫。這就是爲什麼我使用foreach($mother->result() as $row)
。瀏覽器上顯示的每個摺疊數據都有自己的子列表,它們分別有Panel Body
和Panel Footer
。我從瀏覽器上的這些代碼得到的結果是,當我單擊其他摺疊數據按鈕而不是第一個按鈕時,它還向我顯示了第一個摺疊數據按鈕的第一個子列表。如何構建摺疊列表(Codeigniter)
<div class="container">
<h2>Collapsible Panel</h2>
<p>Click on the collapsible panel to open and close it.</p>
<div class="panel-group">
<div class="panel panel-default">
<?php
$mother = $this->db->query("SELECT Description,ChildNode from mrpreport.report where MotherNode='MAIN'");
foreach($mother->result() as $row) {
?>
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" href="#collapse1"><?php echo $row->Description?></a>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse">
<div class="panel-body">Panel Body</div>
<div class="panel-footer">Panel Footer</div>
</div>
<?php } ?>
</div>
</div>
</div>
非常感謝。 – Tee
如果我的回答是真實的,請接受它作爲您的答案,謝謝xD –