1

I'm making my first extension trying to learn Magento. I'm kind of stuck at a part, because I'm wanting to customize the \app\design\adminhtml\default\default\template\widget\grid.phtml file, BUT more than just CMS > Pages uses that file. Is there anyway to break it out so that the CMS > Pages section points to a different grid.phtml file? Surely there is a way I just can't seem to figure it out at the moment.

4

2 回答 2

3

Since you have your own extension, you can change block template via your layout update file. If you don't have one, create it (app/design/adminhtml/default/default/your_extension.xml) and add the following lines into adminhtml section of your extension's config.xml:

<layout>
    <updates>
        <your_extension>
            <file>your_extension.xml</file>
        </your_extension>
    </updates>
</layout>

And your layout update file (in our case it is your_extension.xml) should look like this:

<?xml version="1.0"?>
<layout>
    <adminhtml_cms_page_index>
        <reference name="cms_page.grid">
            <action method="setTemplate">
                <template>widget/grid2.phtml</template>
            </action>
        </reference>
    </adminhtml_cms_page_index>
</layout>
于 2013-05-22T08:54:51.253 回答
1

Within __construct in the class Mage_Adminhtml_Block_Cms_Page_Grid I can put this code

$this->setTemplate('widget/grid2.phtml');

and define whatever template I want. Awesome. Now it is just a matter of making it all upgrade friendly and including it all into my extension in the config.xml file.

于 2013-05-21T21:48:41.687 回答