-1
因此,我正在做我的codeigniter項目。這是我的看法:如何在codeigniter中將echo錨定到foreach中
我的風格,腳本,PHP在一個單一的文件:
<style>
#draggable1 { width: 70px; height: 70px; top:40px; left:9px; }
#draggable2 { width: 70px; height: 70px; top:-30px; left:108px; }
#draggable3 { width: 70px; height: 70px; top:-100px; left:207px; }
#draggable4 { width: 70px; height: 70px; top:-170px; left:311px; }
#draggable5 { width: 70px; height: 70px; top:-240px; left:415px; }
#draggable6 { width: 70px; height: 70px; left:8px; top:-214px; }
#draggable7 { width: 70px; height: 70px; left:109px; top:-283px; }
#draggable8 { width: 70px; height: 70px; left:208px; top:-352px;}
#draggable9 { width: 70px; height: 70px; left:311px; top:-422px;}
#draggable10 { width: 70px; height: 70px; left:417px; top:-492px;}
</style>
<script>
$(function() {
$("#draggable1").draggable();
$("#draggable2").draggable();
$("#draggable3").draggable();
$("#draggable4").draggable();
$("#draggable5").draggable();
$("#draggable6").draggable();
$("#draggable7").draggable();
$("#draggable8").draggable();
$("#draggable9").draggable();
$("#draggable10").draggable();
});
</script>
<?php
echo "<h2>Table Layout</h2>";
if(is_array($databuku)){
echo '<ol><br>';
$i = 1;
foreach($databuku as $key){
$judul = '<div id="draggable'.$i++.'" class="ui-widget-content"><center><strong>'.$key->kode_buku.'</strong>
<br>
<a href="hall_a.html">' .$key->judul_buku. '/' .$key->penerbit. '</a>
<br>
**// I want to put the code between this //**
</center></div>';
echo $judul;
}
echo '</ol>';
}
echo anchor('layout/add_book', 'Add Book');
?>
的問題是,在那裏我可以把這個代碼:
echo anchor('layout/correction_book/'.$key->code_book, 'Edit')." | ";
echo anchor('layout/konfirm_delete_book/'.$key->code_book, 'Delete');
在foreach內以及之前的</center></div>
- 我給出了應該放置代碼的標記。
謝謝,夥計!它工作得很好:) – yogieputra 2014-10-29 08:12:05