Search code examples
magentoblock

Block from controller in magento


I'm trying to display content in /index.php/pincel/payment/error/ and I have the next files:

Block/Error.php

<?php class PincelStudios_Pincel_Block_Error extends Mage_Core_Block_Template { } ?>

etc/config.xml

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

Controller/PaymentController.php

    public function errorAction()
{
    $this->loadLayout()->renderLayout();
}

But I'm getting a white layout without any error (neither in logs) https://i.sstatic.net/vzLkk.png

Any ideas? Thanks in advance


Solution

  • Looks like you have not given all necessary information and the file

    /app/design/frontend/default/default/layout/pincel.xml
    

    is missing.

    <pincel_payment_error>
        <reference name="content"> <!-- Place were you want to display your content -->
            <block type="pincel/error" name="pincel" template="yourtemplate if necessary" />
        </reference>
    </pincel_payment_error>
    

    Do you have it?