Reputation: 61
I have a site with a Magento theme and i found this code PHP.
<div class="product-options sss" id="product-options-wrapper">
<?php echo $this->getChildHtml('', true, true);?>
<?php if ($this->hasRequiredOptions()):?>
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
<?php endif;?>
</div>
Who is this
in this code? My div?
getChildHtml('', true, true);
From what I found on the internet I realized that ''
means all the kids a div (whose div?)
I do not understand what parameters are used boolean true true
... in helping them?
I found it on the internet getChildHtml
method takes things from an XML file.Where can I find this file?
Can you give me explain with a simple example code please?
Thanks in advance!
Upvotes: 0
Views: 122
Reputation: 4564
$this in above code refers to current class(object).
'getChildHtml
' method renders a child block according to the block name or alias supplied in the argument.
<?php echo $this->getChildHtml('',true,true) ?>
Example :
<?php echo $this->getChildHtml('content') ?>
In above example is added to the Magento layout XML in app/design/frontend/base/default/layout/page.xml
This is how we create block in XML file :
<block type="core/text_list" name="content" as="content" translate="label">
<label>Main Content Area</label>
</block>
Upvotes: 3
Reputation: 422
The surrounding HTML code is client side. Your inner PHP code is server-side. The $this
refers to the current executing class function, in this case - Magento template controller.
You can check out an example of developing with Magento templates here: http://code.tutsplus.com/articles/magento-theme-development-template-files--cms-21040
Upvotes: 1