你能告诉我如何将我自己的HTML标签添加到PHP代码的一部分吗?我说的是部分"这部分需要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)). "";
在drupal中,通过设置array('html' => 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