magento : show image before xml elements -
i creating magento admin module. want show image(icon) before title of module.
i want achieve
i have tried following code no luck :(
<title><![cdata[<img src="media/icon.png"/>]]>title</title>
which outputs
----------edit -----
i tried rewrite adminhtml_block_page_menu no success
public function getmenulevel($menu, $level = 0) { $html = '<ul ' . (!$level ? 'id="nav"' : '') . '>' . php_eol; foreach ($menu $index => $item) { $html .= '<li ' . (!empty($item['children']) ? 'onmouseover="element.addclassname(this,\'over\')" ' . 'onmouseout="element.removeclassname(this,\'over\')"' : '') . ' class="' . (!$level && !empty($item['active']) ? ' active' : '') . ' ' . (!empty($item['children']) ? ' parent' : '') . (!empty($level) && !empty($item['last']) ? ' last' : '') . ' level' . $level . '"> <a href="' . $item['url'] . '" ' . (!empty($item['title']) ? 'title="' . $item['title'] . '"' : '') . ' ' . (!empty($item['click']) ? 'onclick="' . $item['click'] . '"' : '') . ' class="' . ($level === 0 && !empty($item['active']) ? 'active' : '') . '">' ////////////edits . ($index == 'modulename' ? $item['label'] : '<span>' . $this->escapehtml($item['label']) . '</span></a>' . php_eol; if (!empty($item['children'])) { $html .= $this->getmenulevel($item['children'], $level + 1); } $html .= '</li>' . php_eol; } $html .= '</ul>' . php_eol; return $html; }
here config.xml menu part
<adminhtml> <menu> <company module="modulename" translate="title"> <title><![cdata[<span class="module-icon">company</span>]]></title> <sort_order>71</sort_order> <children> <modulename translate="title" module="modulename"> <title>theme options</title> <sort_order>0</sort_order> <children> <configuration> <title>configuration</title> <sort_order>1</sort_order> <action>adminhtml/system_config/edit/section/modulename</action> </configuration> </children> </modulename> </children> </company> </menu> </adminhtml>
the admin menu generated mage_adminhtml_block_page_menu
block, escapes html titles (see getmenulevel()
). if want add images in titles, you'll need rewrite block in order remove behaviour.
Comments
Post a Comment