Magento – Magento failing silently, block not being called

xml

I have been working on a module, and last time I checked it displayed as expected. I have now gone to work on other modules and now I have come back to this module it has stopped working and I don't understand why (the Magento header/footer and sidebars are being displayed, but not the content area). Obviously I have changed something somewhere, but I cannot work out where.

I have errors switched on and there are no error showing up in var/log or var/report. Cache is switched off and I don't think any of the xml files within this module was changed.

Due to my module not being displayed I will guess its a misconfigured xml file, but i've looked (and looked) but cant see the problem.

This is an issues I often come across and was wondering if anyone can offer any advice on what steps I should take to solve the issue? is there a a tried and tested method of steps to take to resolve such an issue or is it just look and get very frustrated?

So far I have:

echoed directly from the the Action (text was displayed)

echoed directly from the the Block (nothing was displayed)

compared files since my last upload to git and there are no differences between the code.

My code is as follows (just incase there is an issue i haven't spotted)

app/design/frontend/base/default/layout/ps_prefs/prefs.xml

<layout>  
<prefs_index_signup>
    <reference name="content">
        <block type="prefs/signup" name="prefs_new" template="ps/prefs/new.phtml" />
    </reference>
</prefs_index_signup>
</layout>

app/code/local/Ps/Prefs/Block/Signup.php

class Ps_Prefs_Block_Signup
extends Mage_Core_Block_Template
{
public $key;
public $locale;

public function _construct()
{
    $this->setKey();
    $this->getLocale();
}

app/code/local/Ps/Prefs/etc/config.xml

<global>
    <models>
        <prefs>
            <class>Ps_Prefs_Model</class>
            <resourceModel>prefs_resource</resourceModel>
        </prefs>

        <prefs_resource>
            ....resources.....
        </prefs_resource>
    </models>
        <blocks>
        <prefs>
            <class>Ps_Prefs_Block</class>
        </prefs>
    </blocks>
</global>
<frontend>
    <layout>
        <updates>
            <prefs>
                <file>ps_prefs/prefs.xml</file>
            </prefs>
        </updates>
    </layout>
    <routers>
        <prefs>
            <use>standard</use>
            <args>
                <module>Ps_Prefs</module>
                <frontName>prefs</frontName>
            </args>
        </prefs>
    </routers>
</frontend>
</config>

app/code/local/Ps/Prefs/controllers/IndexController

 class Ps_Prefs_IndexController
    extends Mage_Core_Controller_Front_Action
{
public function signupAction()
{
    $this->loadLayout()->renderLayout();
}

===

EDIT

===

I have broken the layout.xml and still have no errors, so I can see that is not being called, but as you will see from my above code it configured in the config.xml

I have also checked every page in this module and all have the same issue.

Using this line var_dump(Mage::getSingleton('core/layout')->getUpdate()->getHandles()); I can see prefs_index_signup handle is being called

Best Answer

In the case of this question my problem was that the node was being used in another module on my site.

I have often found that I come across little problems that be sorted by systematically working through my code. So I have put together a list I use, I am sure it can be added to, hopefully this will help as a starter

1) Make sure developer mode is enabled.

2) Disable cache/flush cache.

3) Check module config is being loaded (if module does not load check the .xml file in app/etc/modules AKA registration file).

4) Check class pathname & config specified class prefixes (class nodes - double check for plurals on the end of filename).

5) Check classes are extending the correct classes.

6) Check for casing issues.

7) Check your module does not have the same unique nodes as other modules.

Related Topic