Take my example :
<block type="core/template" name="my.name" as="myName" template="path/to/template.phtml"/>
What purpose does the "as=myName" declaration serve. What abstract class defines these default attributes for layout handling?
Take my example :
<block type="core/template" name="my.name" as="myName" template="path/to/template.phtml"/>
What purpose does the "as=myName" declaration serve. What abstract class defines these default attributes for layout handling?
here i can give brief understanding regarding magento block xml tag
name = Name of the block. It should be unique in the page.
**as = Alias **. Smaller form of name. It should be unique in it's parent block.
template = The template file (View) this block is attached to.
You can call methods from block type inside this by using $this.. e.g. $this->getName()
name vs. as example:
<reference name="left">
<block type="block/blocktype1" name="first_block" template="template1.phtml">
<block type="abc/abc" name="ty1" as="common" template="abc.phtml"/>
</block>
<block type="block/blocktype1" name="second_block" template="template2.phtml">
<block type="xyz/xyz" name="ty2" as="common" template="xyz.phtml"/>
</block>
</reference>
So, you can now call block name ty1 from first_block
AND ty2 from second_block
as $this->getChildHtml('common');
, but see both the blocks called will be different as per their calling parent.
for detail class go throw this
Understanding Magento Block and Block Type
hope this will sure help you.
When you use as, you can call $this->getChildHtml("as_value") on the phtml template.
The name must be unique, and can be used for < reference > blocks, < remove >, etc.
For example (catalog.xml):
<block type="catalog/product_view" name="product.info" template="catalog/product/view.phtml">
<block type="catalog/product_view_media" name="product.info.media" as="media" template="catalog/product/view/media.phtml"/>