跨行动链接

时间:2014-11-16 14:16:26

标签: javascript php html twitter-bootstrap-3

我想在Action链接中使用bootstrap span图标

这里是例子

$actions .= "<a href='" . $this->url->link('seller/account-product/delete', 'product_id=' . $product['product_id'], 'SSL') ."' class='btn btn-primary btn-danger' title='" . $this->language->get('ms_delete') . "'></a>";

我希望将其添加到

<span class="glyphicon glyphicon-remove"></span>

2 个答案:

答案 0 :(得分:0)

尝试使用'代替"

$actions .= "<a href='" . $this->url->link('seller/account-product/delete', 'product_id=' . $product['product_id'], 'SSL') ."' class='btn btn-primary btn-danger' title='" . $this->language->get('ms_delete') . "'><span class='glyphicon glyphicon-remove'></span></a>";

答案 1 :(得分:0)

当引用变得毛茸茸时,我更喜欢添加一些辅助变量来使标记更清晰:

$l = $this->url->link('seller/account-product/delete', 'product_id=' . $product['product_id'], 'SSL');
$c1 = 'btn btn-primary btn-danger';
$t = $this->language->get('ms_delete');
$c2 = 'glyphicon glyphicon-remove';

$actions .= "<a href='$l' class='$c1' title='$t'><span class='$c2'></span></a>";

或者,取决于您如何阅读问题:

$actions .= "<span class='$c2'><a href='$l' class='$c1' title='$t'></a></span>";

有时候,更加有益的是:

$h  = " href='"
    . $this->url->link('seller/account-product/delete', 'product_id=' . $product['product_id'], 'SSL')
    . "'";
$c1 = " class='btn btn-primary btn-danger'";
$t  = " title='" . $this->language->get('ms_delete') . "'";
$c2 = " class='glyphicon glyphicon-remove'";

$actions .= "<a$h$c1$t><span$c2></span></a>";