请问您如何在PHP代码中添加自己的HTML标记?我在谈论部分“ 这部分需要HTML标记 ”。
<div id="downbarek2">
<?php
$vid = 59;
function termSort($a, $b) {return strcmp($a->name, $b->name);}
$terms = taxonomy_get_tree($vid); usort ($terms,'termSort');
foreach ($terms as $term) {
if ($term->depth == 1) {
print "" .l( "This part need HTML tag " .$term->name,'taxonomy/term/'.$term->tid, array('title' => $term->name)). "";
}
}
?>
</div>
所以,我的问题是:如何扩展这部分HTML标记,例如......
print "" .l( "<b>This text need HTML tag</b> " .$term->name,'taxonomy/term/'.$term->tid, array('title' => $term->name)). "";
答案 0 :(得分:2)
在drupal中,通过设置数组来实现这一点('html'=&gt; TRUE)
print l( t("<b>This text need HTML tag</b> " .$term->name,'taxonomy/term/'.$term->tid), array('attributes' => array('title' => $term->name, ), 'html' => TRUE) );
参考:http://api.drupal.org/api/drupal/includes%21common.inc/function/l/7