0

i have tried to use block as inner block which is defined in the same layout xml file using "as" in block tag and getchildhtml("as name") in phtml. test.php(layout file)

<block name="name1" type="modulename/blockfilename" template="file1.phtml">
  <block name="name2" type=modulename1/blockfilename1" template="file2.phtml" as="display"></block>
</block>

file1.phtml

<?php $this->getChildhtml("display") ?>

similarly how can we use the magento defined blocks as inner blocks in our blocks for example magento defined Now i want to use as="left" in my block as inner block

If possible can you please let me know with example for better understanding.

Thanks in advance

1

You use;

<?php $this->getChildhtml("display") ?>

when you should use:

<?php echo $this->getChildhtml("display") ?>

To clarify, getChildHtml() only returns a string and you must do something with it like, in this case, echo it.

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.