0
votes

I'm writing a module for magento 1.9. Help please set the attributes for the app/design/frontend/rwd/default/layout/kalinin_form.xml:

<?xml version="1.0" ?>
<layout>
    <kalininform_index_index>
        <reference name="content">
            <block type="kalininform/form" template="Kalinin_Form/index.phtml" />
        </reference>
    </kalininform_index_index>
</layout>

I now have the type attribute set to false.

The problem is that the browser displays a blank page with the content area on localhost/magento3/index.php/form

Here is the rest of the code of the module.

app/design/frontend/rwd/default/template/Kalinin_Form/index.phtml:

<?php
echo('qqqqqqqqqqqqq');

app/code/local/Kalinin/Form/controllers/IndexController.php:

<?php
class Kalinin_Form_IndexController extends Mage_Core_Controller_Front_Action
{

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

}

app/code/local/Kalinin/Form/Block/Form.php:

<?php
class Kalinin_Form_Block_Form extends Mage_Core_Block_Template
{

    public function getNewsCollection()
    {
        Mage::log("Your Log Message");    
        return true;
    }

}

app/code/local/Kalinin/Form/etc/config.xml:

<?xml version="1.0" ?>
<config>
    <modules>
        <Kalinin_Form>
            <version>0.0.1</version>
        </Kalinin_Form>
    </modules>
    <frontend>    
        <layout>
            <updates>
                <kalininform>
                    <file>kalinin_form.xml</file>
                </kalininform>
            </updates>
        </layout>           
        <routers>
            <kalininform>
                <use>standard</use>
                <args>
                    <module>Kalinin_Form</module>
                    <frontName>form</frontName>
                </args>
            </kalininform>
        </routers>
    </frontend>    
    <global>        
        <blocks>
            <Kalinin_Form>
                <class>Kalinin_Form_Block</class>
            </Kalinin_Form>
        </blocks>      
    </global>    
</config>

In general, I have a problem with understanding the attributes into app/design/frontend/rwd/default/layout/kalinin_form.xml

Official documentation is not present. I would be grateful if you explain what's what.

1

1 Answers

0
votes

In your app/design/frontend/rwd/default/layout/kalinin_form.xml file, your block attribute type value is wrong. it should be kalinin_form/form.

<?xml version="1.0" ?>
<layout>
    <kalininform_index_index>
        <reference name="content">
            <block type="kalinin_form/form" template="Kalinin_Form/index.phtml" />
        </reference>
    </kalininform_index_index>
</layout>

Value of type attribute should be matched with blockgroup_name given in config.xml.

Please see, your block group name is Kalinin_Form

<global>        
        <blocks>
            <Kalinin_Form>
                <class>Kalinin_Form_Block</class>
            </Kalinin_Form>
        </blocks>      
</global>