[英]Convert current <a> into CodeIgniter “anchor”
I have the current code 我有当前代码
<a href="http://localhost/dashboard.php">
<i class="fa fa-dashboard"></i>
<span class="menu-text"> Dashboard </span>
</a>
I'm trying to convert it to the standard that code Igniter uses with the anchor tag. 我正在尝试将其转换为Igniter与anchor标签一起使用的代码的标准。 I'm assuming it would be similar to
我假设它类似于
<?= anchor('dashboard/index', 'Dashboard') ?>
But I'm not sure how to get the other tags and classes in there. 但是我不确定如何在其中获取其他标签和类。 Thoughts?
有什么想法吗?
Third parameter , 第三个参数,
<?= anchor('dashboard/index', 'Dashboard','class="fa fa-dashbaord"') ?>
for the span you can just add it directly on the second param 对于跨度,您可以直接将其添加到第二个参数中
<?= anchor('dashboard/index',
'<i class="fa fa-dashboard"></i>
<span class="menu-text"> Dashboard </span>',
'class="fa fa-dashbaord"') ?>
note: be carefull with the single qoutes and double qoutes. 注意:请谨慎使用单qoutes和双qoutes。
In your case: 在您的情况下:
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
You can also try it like this 您也可以这样尝试
$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.