-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