Drupal l功能不起作用

时间:2014-03-12 06:40:46

标签: drupal drupal-7 taxonomy

当我使用$ nid = $ node->时,我正在尝试突出页面的nid; nid他们在drupal 7中停止工作l但是我们的nids突出显示 这是我的代码

$ch1=db_query("SELECT th.tid FROM taxonomy_term_hierarchy th 
  INNER JOIN taxonomy_term_data td ON th.tid=td.tid
  INNER JOIN field_data_field_books book ON book.field_books_tid = th.tid
  WHERE td.vid = '6' AND th.parent = $ch AND book.entity_id = $nid
  ")->FetchField();

$chap1=taxonomy_get_children($ch1);
echo "<ul>";
foreach($chap1 as $ca1){
  $pnid = db_query("SELECT n.nid FROM node n 
  INNER JOIN field_data_field_books book ON book.entity_id = n.nid
  WHERE  book.field_books_tid = $ca1->tid AND n.nid = $nid " )->FetchField();
  if($nid == $pnid){
    print "<li class='b'><b>".$ca1->name."</b></li>";
  } else {
    $link = l($ca1->name, 'node/' . $pnid);
  print "<li class='a'>". $link."</li>";
  }
}
echo "</ul>";

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

尝试网址功能如下:

$link = url('node/' . $pnid);
print "<li class='a'><a href='". $link."'> ".$ca1->name." </a></li>";