I've created an extension which seems to be partially working but not executing any of the code in the template file.

With the code in indexAction() just echoing, the content is output as one might expect, however with;

public function indexAction()

The page only returns the blank standard page template.

The frontname.xml file looks like this

    <reference name="content">
    <block type="core/text">
        <block type="frontname/frontname" name="frontname" template="frontname/frontname.phtml"/>

Config.xml contains:

<?xml version="1.0" encoding="UTF-8"?>


class NewModule_Frontname_Block_Frontname extends Mage_Core_Block_Template{
 public function myfunction(){
    return "Tesing123";


I've found the exception trace as follows:

        exception 'Mage_Core_Exception' with message 'Invalid block type: Newmodule_Frontname_Block_Frontname' in /path/to/app/Mage.php:595
        Stack trace:
        #0 /path/to/includes/src/__default.php(27814): Mage::throwException('Invalid block t...')
        #1 /path/to/includes/src/__default.php(27756): Mage_Core_Model_Layout->_getBlockInstance('frontname/front...', Array)
        #2 /path/to/includes/src/__default.php(27791): Mage_Core_Model_Layout->createBlock('frontname/front...', 'frontname')
        #3 /path/to/includes/src/__default.php(27558): Mage_Core_Model_Layout->addBlock('frontname/front...', 'frontname')
        #4 /path/to/includes/src/__default.php(27524): Mage_Core_Model_Layout->_generateBlock(Object(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_Layout_Element))
        #5 /path/to/includes/src/__default.php(27529): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
        #6 /path/to/includes/src/__default.php(13911): Mage_Core_Model_Layout->generateBlocks()
        #7 /path/to/includes/src/__default.php(13836): Mage_Core_Controller_Varien_Action->generateLayoutBlocks()
        #8 /path/to/app/code/local/Newmodule/Frontname/controllers/IndexController.php(6): Mage_Core_Controller_Varien_Action->loadLayout()
        #9 /path/to/includes/src/__default.php(13985): Newmodule_Frontname_IndexController->indexAction()
        #10 /path/to/includes/src/__default.php(18380): Mage_Core_Controller_Varien_Action->dispatch('index')
        #11 /path/to/includes/src/__default.php(17910): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
        #12 /path/to/includes/src/__default.php(20535): Mage_Core_Controller_Varien_Front->dispatch()
        #13 /path/to/app/Mage.php(684): Mage_Core_Model_App->run(Array)
        #14 /path/to/index.php(102): Mage::run('', 'store')
        #15 {main}

Make sure following points.

  1. Make sure you have frontname part of your custom layout update handle frontname_index_index is defined inside your config.xml file. (or show us your config.xml if possible)

  2. Try this code first.

        <reference name="content">
            <block type="core/template" name="frontname" template="frontname/frontname.phtml"/>

    and make sure you have your template file does exist in your package/theme design directory. ie at app\design\frontend\{package}\{theme}\template\frontname\frontname.phtml

  3. If the above step worked, then you can try this.

        <reference name="content">
            <block type="frontname/frontname" name="frontname" template="frontname/frontname.phtml"/>
  4. If step 3 didn't work, then that indicates you have no such block types frontname/frontname. So define that then.

We can give more specific informations if you can show your config.xml file. Let me know your doubts. Good luck


You block is not working because, you have a wrong class definition. Your class name should be NewModule_FrontName_Block_Frontname instead of NewModule_FrontName_Block_FrontName. (Also make sure, block file name should be app/code/local/NewModule/FrontName/Block/Frontname.php)


keep your block class name as it is and update the block layout definition like this (in this case, block file name should be app/code/local/NewModule/FrontName/Block/FrontName.php.

 <block type="frontname/frontName" name="frontname" template="frontname/frontname.phtml"/>
  • @Wren Everything looks good in config.xml file. So try the second solution first. If that showed the content of your template file, then go for third step. let me know whether you are facing any diffculties – Rajeev K Tomy Aug 13 '15 at 6:17
  • Thanks very much for this. So, step 2 works for me, but then changing the type back to "frontname/frontname" takes me back to where I started; I've added the NewModule/FrontName/Block/FrontName.php above – Wren Aug 13 '15 at 6:39
  • it also looks good. double check the file path. make sure <?php is present very above that file. and also make sure, you have used step3 in my answer. clear your cache. – Rajeev K Tomy Aug 13 '15 at 6:46
  • <?php tag is present and correct, but still no joy. The path to the Block file is "app/code/local/NewModule/FrontName/Block" But it's still not being picked up... Is the any way to trace the route from the XML to the Block definition? I've turned the cache off completely. – Wren Aug 13 '15 at 6:50
  • Other than this.. I cant see any problem with your codes. Lastly, please check for any log errors.. – Rajeev K Tomy Aug 13 '15 at 6:52

Please check the below link. This consist the same thing which you wish to implement


  • The link only answers are treating as bad because the answer become unuseful if the link become idle. So try to put a short view of that link with your answer if possible. Thanks. – Rajeev K Tomy Aug 13 '15 at 7:47
  • I'm afraid that this doesn't quite address my problem, I'm able to echo from the IndexController without any issue - the problem is specifically loading the phtml via the Block definition. Thank you. – Wren Aug 13 '15 at 9:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.