Forms 在一列布局上显示Magento自定义电子邮件联系人表单

Forms 在一列布局上显示Magento自定义电子邮件联系人表单,forms,magento,customization,contact,Forms,Magento,Customization,Contact,我一直在关注关于Inchoo的Inchoo 我已经让它工作了,但他有代码在三列布局上显示联系人表单,我需要在一列布局上显示它。以下是我认为相关的代码: <?php class Inchoo_SimpleContact_IndexController extends Mage_Core_Controller_Front_Action { public function indexAction() { //Get current layout state

我一直在关注关于Inchoo的
Inchoo

我已经让它工作了,但他有代码在三列布局上显示联系人表单,我需要在一列布局上显示它。以下是我认为相关的代码:

<?php
class Inchoo_SimpleContact_IndexController extends Mage_Core_Controller_Front_Action
{
    public function indexAction()
    {
        //Get current layout state
        $this->loadLayout();
        $block = $this->getLayout()->createBlock(
            'Mage_Core_Block_Template',
            'inchoo.simple_contact',
            array(
                'template' => 'inchoo/simple_contact.phtml'
            )
        );

        $this->getLayout()->getBlock('content')->append($block);
        //$this->getLayout()->getBlock('right')->insert($block, 'catalog.compare.sidebar', true);
        $this->_initLayoutMessages('core/session');
        $this->renderLayout();
    }

    public function sendemailAction()
    {
        //Fetch submited params
        $params = $this->getRequest()->getParams();
        $mail = new Zend_Mail();
        $mail->setBodyText($params['comment']);
        $mail->setFrom($params['email'], $params['name']);
        $mail->addTo('mail@mybelovedangels.com', 'Some Recipient');
        $mail->setSubject('Test Inchoo_SimpleContact Module for Magento');
        try {
            $mail->send();
        }
        catch(Exception $ex) {
            Mage::getSingleton('core/session')->addError('Unable to send email. Sample of a custom notification error from Inchoo_SimpleContact.');


        }
        //Redirect back to index action of (this) inchoo-simplecontact controller
        $this->_redirect('inchoo-simplecontact/');
    }
}
?> 

我一直在网上寻找答案,但我运气不好,什么都没找到。我认为它与
Mage\u Core\u Block\u模板有关

抓住布局手柄(类似于inchoo\u simplecontact\u index\u index)并执行一些layout.xml魔术:

<inchoo_simplecontact_index_index>
      <reference name="root">
            <action method="setTemplate"><template>page/1column.phtml</template></action>
      </reference>
</inchoo_simplecontact_index_index>
或者通过代码执行:

$template = Mage::getConfig()->getNode(‘global/page/layouts/one_column/template’);
$this->getLayout()->getBlock(‘root’)->setTemplate($template);

祝你好运

谢谢。就这样。这个句柄只是一个FreeRouterNamehereno1_index_index:)现在我几乎可以在任何地方使用了!
$template = Mage::getConfig()->getNode(‘global/page/layouts/one_column/template’);
$this->getLayout()->getBlock(‘root’)->setTemplate($template);