Adminhtml layouts

Adminhtml Grid and Edit is possible to add from layout or it is possible to specify directly in Adminhtml controller for example:

this way:

app/design/adminhtml/default/default/layout/photo.xml
<?xml version="1.0"?>
<layout>
    <adminhtml_photograph_index>
        <reference name="content">
            <block type="photo/adminhtml_photograph" name="photograph" />
        </reference>
    </adminhtml_photograph_index>
    <adminhtml_photograph_edit>
        <reference name="content">
            <block type="photo/adminhtml_photograph_edit" name="photograph_edit" />
        </reference>
    </adminhtml_photograph_edit>
</layout>

or this way:

    public function indexAction()
    {
	...
        $this->_addContent($this->getLayout()->createBlock('photo/adminhtml_photograph'));
        $this->renderLayout();
    }
 
    public function editAction()
    {
	...
        $this->_addContent($this->getLayout()->createBlock('photo/adminhtml_photograph_edit'));
        $this->renderLayout();
    }

Leave a Reply