Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

help, cant get my module to load my template (SOLVED)
 
alanin
Member
 
Total Posts:  67
Joined:  2008-02-25
Nordhausen, Germany
 

Hello there,

i’ve been trying to write my own module to save new customers into an extra table, cause we have to process the Information before they get access to the shop.

I am able to get my module loaded, its called register and http://www.domain.com/register points to my module. This works very nice, i am able to set the title of the page aswell.

in my config.xml i have that part - but somehow my register.xml in the design/frontend/default/default/layout/ is not touched. all i can see on the http://www.domain.com/register is the main design (3 columns) and no text in the content part.

i dont now what else to try to get this working
thank you for helping
Joerg // Alanin

my IndexController:

class BC_Register_IndexController extends Mage_Core_Controller_Front_Action
{    
    
public function indexAction()
    
{
        $this
->loadLayout();
        
$this->getLayout()->getBlock('head')->setTitle(Mage::helper('customer')->__('Create New Customer Account'));
        
$this->renderLayout();
    
}
}

part of my config.xml

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

my register.xml

<?xml version="1.0"?>
<layout version="0.1.0">

<!--
Default 
layoutloads most of the pages
-->

    <default>
        <
reference name="root">
            <
action method="setTemplate"><template>page/one-column.phtml</template></action>
        </
reference>
        <
reference name="content">
            <
block type="register/form" name="register.form" template="register/form.phtml"/>
        </
reference>
    </default>

</
layout>

and my template/register/form.phtml:

this is a text
 
Magento Community Magento Community
Magento Community
Magento Community
 
alanin
Member
 
Total Posts:  67
Joined:  2008-02-25
Nordhausen, Germany
 

tried some more - dont have an error, but dont have my template parsed into the html neither....

$this->getLayout()->getBlock('content')->setTemplate('register/form.phtml');
 
Magento Community Magento Community
Magento Community
Magento Community
 
alanin
Member
 
Total Posts:  67
Joined:  2008-02-25
Nordhausen, Germany
 

it seems that my register.xml is not loaded, i tried to put produce invalid XML code in there and nothing happens…

 
Magento Community Magento Community
Magento Community
Magento Community
 
alanin
Member
 
Total Posts:  67
Joined:  2008-02-25
Nordhausen, Germany
 

noone with an idea?!

 
Magento Community Magento Community
Magento Community
Magento Community
 
alanin
Member
 
Total Posts:  67
Joined:  2008-02-25
Nordhausen, Germany
 

finaly i were able to have a block with my name in the profiler, so it seems that my register.xml is loaded… - but still no content from the form.phtml in my browser…

maybe that problem is so simple to solve that noone wanna answer or noone can answer cause its kinda more difficult…

perhaps a teammember could enlighten me?!

Thanks Alanin // Joerg

 
Magento Community Magento Community
Magento Community
Magento Community
 
mzentrale1
Guru
 
Total Posts:  731
Joined:  2007-12-06
Stuttgart, Germany
 

Hi,

here an example how i did it

My controller:

class Mage_Shoporder_IndexController extends Mage_Core_Controller_Front_Action
{
    
    
public function indexAction()
    
{
        $this
->loadLayout();
        
$this->getLayout()->getBlock('shoporderForm')
            ->
setFormActionMage::getUrl('*/*/post') );
        
$this->_initLayoutMessages('customer/session');
        
$this->renderLayout();
    
}

My config.xml

<frontend>
        <
routers>
            <
shoporder>
                <use>
standard</use>
                <
args>
                    <
module>Mage_Shoporder</module>
                    <
frontName>shoporder</frontName>
                </
args>
            </
shoporder>
        </
routers>        
        <
layout>
            <
updates>
                <
shoporder>
                    <
file>shoporder.xml</file>
                </
shoporder>
            </
updates>
        </
layout>
    </
frontend>

My shoporder.xml

<layout version="0.1.0">
    <default>        
    </default>    
    <
shoporder_index_index>        
        <
reference name="root">
            <
action method="setTemplate"><template>page/2columns-right.phtml</template></action>
            <
action method="setHeaderTitle" translate="title" module="shoporder"><title>Shop order</title></action>
        </
reference>
        <
reference name="content">            
            <
block type="core/template" name="shoporderForm" template="shoporder/form.phtml"/>            
        </
reference>
    </
shoporder_index_index>    
</
layout>

Snippet of form.phtml

<form action="<?=$this->getFormAction();?>" name="contactForm" id="contactForm" method="post">

KR

Stefan

 
Magento Community Magento Community
Magento Community
Magento Community
 
alanin
Member
 
Total Posts:  67
Joined:  2008-02-25
Nordhausen, Germany
 

thank you alot - that worked…

and the best i’ve found the problem with your help

old (not working):

<layout version="0.1.0">
    <default> 
        <
reference name="content">            
            <
block type="bcregister/formular" name="bcregister.form" template="bcregister/form.phtml"/>            
        </
reference>   
    </default>    
</
layout>

new (working):

<layout version="0.1.0">
    <default> 
    </default>    
    <
register_index_index>
        <
reference name="content">            
            <
block type="bcregister/formular" name="bcregister.form" template="bcregister/form.phtml"/>            
        </
reference>   
    </
register_index_index>    
</
layout>
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top