I am adding one phtml file in customer account dashboard index page. I have used the code as

    <reference name="customer_account_dashboard">
      <block type="ecustomers/myphtml" name="myphtml_page"  after="customer_account_dashboard_hello" template="ecustomers/myphtml.phtml" />

And I want to show the phtml after the hello.phtml in user dashboard.

If I use <reference name="content"> handle then it shows my phtml content but if I use <reference name="customer_account_dashboard"> handle it does not show the my phtml file.

I think we can use the reference for the block which we want to update as I want to update the customer_account_dashboard so I referenced it. Please let me know if I am wrong in here.

  • is there anyone :) ??
    – MagentoBoy
    Jan 22 '14 at 14:10

There is nothing wrong with your xml, apart from the fact that the before="" will have no function here.

The issue is that dashboard block is not a core text list type of block. Thus the phtml that deals with the dashboard display will not 'magically' output your block.

You need to add an entry to the dashboard.phtml file to echo out your block.

<?php echo $this->getChildHtml('myphtml_page') ?>

and place that in the correct position above the code the outputs the hello block

Naturally you will copy the dashboard.phtml file to your theme to make this edit ;)

netbeans debug showing child blocks

EDIT: Added to answer OP's question about core text list

A core text list is a magento class, which holds a list of child blocks, and will generate a concatenated HTML output of all the child blocks as one HTML block.

a good example of one is 'before_body_end' as define in the layout page.xml file

<block type="core/text_list" name="before_body_end" as="before_body_end" translate="label">
                <label>Page Bottom</label>

thus, when you assign a child block to a core/text_list derived block, the child's HTML will be generated for you.

you will find the 'magic' in Mage_Core_Block_Text_List::_toHtml()

  • Thank youu very much :) ...Enjoying learning magento now ... But I have Questions now ..what does it mean by "core text list type of block" and which tool you are using to see all the variables classes and methods.. sry I am new in programming and magento ... just want to learn everything which i see strange ;) ... thanks again
    – MagentoBoy
    Jan 22 '14 at 16:41
  • 1
    The image if from my IDE (netbeans) using xdebug and a breakpoint set on line 29 of the dashboard.phtml file. I prefer netbeans as I use the one IDE for multiple language coding. A popular PHP IDE is PHPStorm. There are more. Try them out, and choose one you like. Using breakspoints with a debugger is an essential for any development, as it allows you to clearly view what is going on in the code at run-time.
    – ProxiBlue
    Jan 23 '14 at 1:46
  • I have expanded on the answer to clarify the core text list blocks
    – ProxiBlue
    Jan 23 '14 at 1:54
  • :) thanks for your very good answer... As I understood we can Modify the block dynamically or can call block which are structural blocks ... i think it is in the "core text list".. and data blocks can not be modified by using <reference> and calling the block and phtml file directly so we need to modify the dashboard. php file by coping it in diff theme..Please let me know if I am wrong. And thanks for pointing for new good IDE and xdebug ... I will learn now :)
    – MagentoBoy
    Jan 23 '14 at 5:59
  • Hey I have added new theme so I can edit the dashboard.phtml file but it is still showing the same. Even I edited the customer.xml layout file <block type="ecustomers/myphtml" name="myphtml_page" after="customer_account_dashboard_hello" template="ecustomers/myphtml.phtml" /> in which I haved added diret block inside and added in phtml file with
    – MagentoBoy
    Jan 24 '14 at 5:05

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.