【问题标题】:not able to retrieve subterm image in page-taxonomy.tpl.php无法在 page-taxonomy.tpl.php 中检索子术语图像
【发布时间】:2011-05-23 14:02:18
【问题描述】:

我希望我的分类页面以特定方式设置样式。为此,我在 template.php 中完成了必要的操作。现在我已经准备好 page-taxonomy.tpl.php 并且可以工作了。我正在使用分类图像模块将图像上传到分类术语。我正在使用 taxonomy_image_get_url($term->tid); 检索相应术语的图像并显示它们。现在我想检索这个术语的子术语,我已经能够使用 _taxonomy_term_children($term->tid)

问题是我无法检索它的图像。

            <?php if ( arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric(arg(2)) ) {
              $term = taxonomy_get_term(arg(2));
              $image_url = taxonomy_image_get_url($term->tid);
              print $image_url;
             }?>
            <div id="taxonomy_term_image"><img src="/sites/default/files<?php print $image_url;?>" /></div>
            <div id="taxonomy_term_description"> <?php print $term->description;?>                <?php print $images_url;?></div>
                              <?php print $feed_icons; ?><br/>
              Sub Categories:  <?php $taxonomy_children = _taxonomy_term_children($term->tid);
            foreach ($taxonomy_children as $value) {  
                $tax_child = taxonomy_get_term($value);
                print $tax_child->name;
                print $tax_child->description; 
                $subterm_image = taxonomy_image_get_url($taxchild->tid);
                                    print $subterm_image;
                }?>

【问题讨论】:

    标签: drupal drupal-theming drupal-taxonomy


    【解决方案1】:

    您缺少用于呈现图像的 HTML 代码。需要像你做父图像一样把它放进去:

    <img src="/sites/default/files<?php print $subterm_image;?>" />
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-02
      • 1970-01-01
      • 2020-08-05
      • 1970-01-01
      • 1970-01-01
      • 2019-09-22
      相关资源
      最近更新 更多