簡體   English   中英

將電流轉換<a>為CodeIgniter“錨點”</a>

[英]Convert current <a> into CodeIgniter “anchor”

我有當前代碼

<a href="http://localhost/dashboard.php">
  <i class="fa fa-dashboard"></i>
  <span class="menu-text"> Dashboard </span>
</a>

我正在嘗試將其轉換為Igniter與anchor標簽一起使用的代碼的標准。 我假設它類似於

<?= anchor('dashboard/index', 'Dashboard') ?>

但是我不確定如何在其中獲取其他標簽和類。 有什么想法嗎?

第三個參數,

<?= anchor('dashboard/index', 'Dashboard','class="fa fa-dashbaord"') ?>

對於跨度,您可以直接將其添加到第二個參數中

<?= anchor('dashboard/index', 
           '<i class="fa fa-dashboard"></i>
            <span class="menu-text"> Dashboard </span>',
           'class="fa fa-dashbaord"') ?>

注意:請謹慎使用單qoutes和雙qoutes。

文件資料

錨點(uri段,文本,屬性)

在您的情況下:

anchor('dashboard/index', 'Dashboard',array('class' => 'fa fa-dashboard','id'=>'your_id','title'=>'Link_title'))
//You can add multiple attributes in an array.nice class by the way

參見文檔

嘗試這樣:

echo anchor('dashboard/index', 'My News', 'title="News title"');

原始語法為:

anchor(uri segments, text, attributes);

詳細信息在這里

您也可以這樣嘗試

$dashboard  =   '<i class="fa fa-dashboard"></i><span class="menu-text"> Dashboard </span>';
<?= anchor('dashboard/index', '$dashboard') ?>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM