1

こんにちは、コンポーネントの管理セクションにカスタム ボタン リンクを作成しました。次のようなものです。

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

ただし、画像が割り当てられておらず、ボタンに割り当てる方法がわかりません。誰も私がこれを行う方法を知っていますか?

4

1 に答える 1

6

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);

?>
于 2010-11-03T03:25:15.027 に答える