activeDev
activeDev

Reputation: 795

Magento layout basics

Im going through a version of No-frills Magento Layout (perhaps 4-5 months old) and am basically stuck right in the beginning.

In Indexcontroller, in the index action, I create a new block object.

public function indexAction()
{
    //$this->loadLayout();
    $block = new Mage_Core_Block_Template();
    $block->setTemplate('helloworld.phtml');
    //print_r($block->getTemplateFile());
    echo $block->toHtml();
    //$this->renderLayout();

I should then create a template file, namely helloworld.phtml and place it in the appropriate directory. I'm used to using a layout file to do this, but I am going through the book and am simply not able to render the file.

I have placed the phtml file in the following locations :

.../app/design/frontend/default/default/template
.../app/design/frontend/base/default/template

which is also the output of

print_r($block->getTemplateFile());

Im obviously missing something here. any chance someone can point it out?

cheers

Upvotes: 2

Views: 713

Answers (1)

Alana Storm
Alana Storm

Reputation: 166046

Based on the comments above, I'd jump directly to to PHP file for the Mage_Core_Block_Template class

app/code/core/Mage/Core/Block/Template.php

Look for the include line and add some debugging that var_dumps whatever file Magento is trying to include OR add some debugging around the conditionals to determine why this isn't getting called.

Upvotes: 1

Related Questions