23.02.2015 Views

www.it-ebooks.info

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 2<br />

° ° template: This property determines the .phtml template file, which<br />

will be used for rendering the block.<br />

° ° action: Each block type has specific actions that affect the frontend<br />

functional<strong>it</strong>y. For instance, the page/html_head block, which has<br />

actions for adding CSS and JavaScript (addJs and addCss).<br />

° ° as: This is used to specify the unique identifier that we will be using<br />

for calling the block from the template, for example calling a child<br />

block by using getChildHtml('block_name').<br />

Blocks are a new concept that Magento implements in order to reduce the controller<br />

load. They are basically data resources that communicate directly w<strong>it</strong>h the models,<br />

which manipulate the data, if needed, and then pass <strong>it</strong> to the views.<br />

Finally, we have our PHTML files; the templates contain the html and php tags and<br />

are in charge of formatting and displaying the data from our models. Let's take a<br />

look at a snippet from the product view template:<br />

<br />

...<br />

<br />

<br />

<br />

...<br />

<br />

<br />

<br />

<br />

<br />

...<br />

<br />

<br />

<br />

<br />

<br />

<br />

...<br />

<br />

[ 45 ]<br />

<strong>www</strong>.<strong>it</strong>-<strong>ebooks</strong>.<strong>info</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!