【问题标题】:How to put echo anchor into foreach in codeigniter如何在codeigniter中将回声锚放入foreach
【发布时间】:2014-10-29 07:31:40
【问题描述】:

所以,我正在做我的 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 内部和 &lt;/center&gt;&lt;/div&gt; 之前

  • 我在应该放置代码的位置打上标记。

【问题讨论】:

    标签: javascript php css codeigniter


    【解决方案1】:

    您可以使用以下代码:

    $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;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-09-04
      • 2012-03-24
      • 2016-10-08
      • 1970-01-01
      • 2021-05-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多