dti3914 2014-07-11 08:25
浏览 26

什么是显示图像src的Drupal功能?

I have an HTML file and some images. While theming, I have used the function drupal_get_path to display the images, but none of them are showing. I have already tried the code below. If anyone could help, it would be a great help.

<?php echo drupal_get_path('theme', 'THEME_NAME'); ?>/images/slider/slide1_baner1.jpg" alt="" />  
  • 写回答

3条回答 默认 最新

  • dongxun3424 2014-07-11 12:35
    关注

    Use $GLOBALS['theme'] for get the current theme's path (Optional).

    Use theme_image to get the html of an image.

    The Drupal way for resolving this problem would be something like this:

    $variables = array(
      'path' => drupal_get_path('theme', 'THEME_NAME').'/images/slider/slide1_baner1.jpg',
      'alt' => 'Alt of image',
      'title' => 'Image title',
      'width' => '50%',
      'height' => '50%',
      'attributes' => array('class' => 'img-class', 'id' => 'banner1'),
    );
    $output = theme('image', $variables );
    
    评论

报告相同问题?

悬赏问题

  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?