所以,我正在做我的codeigniter项目。这是我的观点:
我将样式,脚本和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>
答案 0 :(得分:0)
您可以使用以下代码:
$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>
'.anchor('layout/correction_book/'.$key->code_book, 'Edit').' |
'.anchor('layout/konfirm_delete_book/'.$key->code_book, 'Delete').'
</center></div>';
echo $judul;