【问题标题】:Add image to Joomla JToolBar custom link button将图像添加到 Joomla JToolBar 自定义链接按钮
【发布时间】:2011-05-04 00:26:47
【问题描述】:

您好,我在组件的管理部分创建了一个自定义按钮链接,如下所示:

$bar = & JToolBar::getInstance('toolbar');
$bar->appendButton( 'Link', 'export', 'Export', 'index.php?option=com_component&task=export&format=raw' );

但是没有图像分配给它,我不知道如何为按钮分配一个图像。有谁知道我该怎么做?

【问题讨论】:

    标签: joomla components jtoolbar


    【解决方案1】:

    您需要创建名为 icon-32-export 的 CSS 类,并带有图像背景。

    这是一个例子:

    <?php
    
    // Add CSS class to the document, it's better to have it in external CSS document
    $imgPath = JRoute::_('/administrator/templates/khepri/images/toolbar/icon-32-new.png');
    JFactory::getDocument()->addStyleDeclaration(".icon-32-export { background: url($imgPath); }");
    
    //
    $bar = & JToolBar::getInstance('toolbar');
    $url = JRoute::_('index.php?option=com_component&task=export&format=raw');
    $bar->appendButton( 'Link', 'export', 'Export', $url);
    
    ?>
    

    【讨论】:

      猜你喜欢
      • 2012-11-04
      • 2014-07-29
      • 1970-01-01
      • 2014-04-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-25
      • 1970-01-01
      相关资源
      最近更新 更多