Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 664003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:33:06+00:00 2026-05-13T23:33:06+00:00

I am currently working on a Magento extension, and I have overridden a core

  • 0

I am currently working on a Magento extension, and I have overridden a core controller, which works fine.

I have now added a new action to my controller. Problem is that whenever I call the action a blank page is produced. If I echo something it is displayed correctly.

Therefore I dug into the core of the Customer module and controllers. I saw there that methods like indexAction() implement the layout this way:

<?php
public function indexAction()
{
  $this->loadLayout();
  $this->_initLayoutMessages('customer/session');
  $this->_initLayoutMessages('catalog/session');

  $this->getLayout()->getBlock('content')->append(
      $this->getLayout()->createBlock('customer/account_dashboard')
  );
  $this->getLayout()->getBlock('head')->setTitle($this->__('My Account'));
  $this->renderLayout();
}

I transferred this to my own action and the layout is now rendered correctly. Now for the question:

No matter what I enter into the ->createBlock('...') call, nothing is rendered into the content area.

How do I specify the location of my own block to be rendered as the content of the page while still decorating it with the layout?

I tried fiddling with the xml files in /design/frontend/base/default/layout/myaddon.xml but couldn’t really make it work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T23:33:06+00:00Added an answer on May 13, 2026 at 11:33 pm

    Covering the entirety of the Magento layout system in a single StackOverflow post is a little much, but you should be able to achieve what you want with the following.

        $block = $this->getLayout()->createBlock('Mage_Core_Block_Text');
        $block->setText('<h1>This is a Test</h1>');
        $this->getLayout()->getBlock('content')->append($block);
    

    Starting from the above, you should be able to build up what you need. The idea is you’re creating your own blocks, and then append them to existing blocks in the layout. Ideally, you’re creating your own block classes to instantiate (rather than Mage_Core_Block_Text), and using their internal template mechanism to load in phtml files (separating HTML generation from code generation).

    If you’re interested in learning the internals of how the layout system works, you could do a lot worse than to start with an article I wrote on the subject.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently working on a custom module in which I have a controller extending
I'm currently working on a new Magento template, and I'm facing problems with jQuery.
Im currently working with an API which requires we send our collection details in
I`m currently working on a script, and I have the following situation. function somnicefunction()
Im currently working on an app which lists a set of objects in a
I am currently working on a Magento store (ver. 1.6.2.0) however when i click
Im currently working on a site which will contain a products catalog. I am
Im currently working on a custom product list in the Magento backend. Heres the
I am working on a magento admin module and currently I am running a
I am working with the magento api and I have run into a bit

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.