ringerce
ringerce

Reputation: 533

Override magento core admin templates

What's the best way to override a core Magento admin template? For example:

app\design\adminhtml\default\default\template\page\header.phtml

I simply want to create a link on the top right menu without modifying it directly or having to re-create the entire template. Right now I have a custom module that has a layout block like this:

<reference name="header">
<action method="setTemplate">
<template>mynamespace_mymodule/header.phtml</template>
</action>
</reference>

That works fine but I have to recreate the template entirely. Is there any way to just add the link without recreating the entire template again?

Upvotes: 0

Views: 1241

Answers (2)

Lucas Moeskops
Lucas Moeskops

Reputation: 5443

You can also setup the adminhtml to have a base and custom version (based on theme) and copy the default content to app/design/adminhtml/base/default/. Then copy the templates you want to edit to app/design/adminhtml/your_package/your_theme/ and apply the theme in the admin. This way you still duplicate it, but in a more logical and neat manner imho.

N.B. note that you will also have to apply this to skin/adminhtml

Upvotes: 1

Peter O&#39;Callaghan
Peter O&#39;Callaghan

Reputation: 6186

Unfortunately no, if you need it to be included inside that container div, there is not a way you can do it without duplicating the entire template. Often templates will include points you can hook into by doing things like $this->getChildHtml('before_body_close'), or the even more generic $this->getChildHtml(), but in this case there are no such calls. You could probably include a new block as a sibling to the header block and try to position it with CSS, but it would be very tricky to get right, and likely unmaintainable anyway.

Upvotes: 2

Related Questions