2011-03-23 119 views
1

我建立一個單一用戶博客使用Drupal 7.我用文章內容類型,博客條目,其鏈接顯示數組變量。我需要自定義節點的外觀。我還爲文章引用類別添加了分類字段。我需要在一個特定的地方在我的節點,以顯示這個和標籤。的Drupal 7:node.tpl.php

所以,我寫的代碼DPM(get_defined_vars());並獲得變量(如下圖所示)

,但我怎麼能顯示我的節點這些變量 - article.tpl.php鏈接到一個頁面列出了其他文章條目具有這些標記,類別?這些陣列,我需要鏈接到顯示每個數組項:/

enter image description here

欣賞幫助!!!!非常感謝!

回答

1

不知何故

<?php 
    $links = array(); 
    foreach ($node->field_tags AS $term) { 
    $links[] = l($term['taxonomy_term']->name, 'taxonomy/term/'. $term['tid']); 
    } 
    print implode(', ', $links) .'<br />'; 

    $links = array(); 
    foreach ($node->field_blog_post_category['und'] AS $term) { 
    $links[] = l($term['taxonomy_term']->name, 'taxonomy/term/'. $term['tid']); 
    } 
    print implode(', ', $links); 
?> 
+0

完美先生! ... – Steve 2014-05-05 13:12:06