我正在开发一个扩展,并希望在扩展后端页面显示图像。我已经将图片存储在我的扩展的' images‘文件夹中。我正在尝试使用<img>标签显示图像。我已经在"src“属性中提供了图像url,但它不在后端页面显示图像。在system.xml中,我使用了以下代码:
<myOption translate="label">
<label>My Label</label>
<frontend_type>radios</frontend_type>
<source_model>mymodule/source_buttons</source_model>
<sort_order>30</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</myOption>Model\Source\Buttons.php文件中的代码:-
<?php
class mycompany_mymodule_Model_Source_Buttons
{
public function toOptionArray()
{
$result = array();
$result[] = array('value' => '32', 'label'=>'<img src="'.Mage::getModuleDir('', 'mycompany_mymodule').DS.'Skin'.DS.'Images'.DS.'img32.png" />');
$result[] = array('value' => '16', 'label'=>'<img src="'.Mage::getModuleDir('', 'mycompany_mymodule').DS.'Skin'.DS.'Images'.DS.'img16.png" />');
return $result;
}
}在扩展后端页面上,它显示:-
<img src="C:\wamp\www\magento\app\code\community\mycompany\mymodule\Skin\Images\img32.png">但是src属性值链接到:-
http://mydomain/magento/index.php/admin/system_config/edit/section/mymodule_options/key/b834efa05ef37070c94d28c6b44e4bf0/C:/wamp/www/magento/app/code/community/mycompany/mymodule/Skin/Images/img32.png请帮帮我。
发布于 2013-03-02 11:19:51
试试这个:
echo $this->getSkinUrl();你可以找到你的图片的路径。
https://stackoverflow.com/questions/15159295
复制相似问题