Understanding getChildHtml in Magento
From the next line in 2columns-right.phtml
<div class="col-main"> <?php echo $this->getChildHtml('global_messages') ?> <?php echo $this->getChildHtml('content') ?> </div> I can't figure out where the content comes from <?php echo $this->getChildHtml('content') ?> .
The witch.phtml file is called to display data using <?php echo $this->getChildHtml('content') ?>
If we discuss the website interface, the specific line you asked for ...
<?php echo $this->getChildHtml('content') ?> added to the Magento XML layout in app / design / frontend / base / default / layout / page.xml. In Magento version 1.8, you will find it on lines 92-94.
<block type="core/text_list" name="content" as="content" translate="label"> <label>Main Content Area</label> </block> By looking at the "type" attribute of this block tag, we can find out what class of the object this section of the layout is. It comes from the "Core" module and has a block type text list. The class name for this Mage_Core_Block_Text_List. (Application / code / kernel /Mag/Kernel/block/text/list.php). Text lists are simply blocking containers whose purpose is to store additional child blocks in them. You can add any number of child blocks to the text list, and they will be displayed either in the order in which they were added, or in the order in which they were assigned.
So, to answer your question, there is no view script (.phtml file) that displays the contents of $ this-> getChildHtml ('content'). Blocks that were added to this block themselves may have associated view scripts. To find out what viewing scenarios are there, you will need to find the XML layout that the block added.
For example, if I had the following layout file added to the interface of my website theme:
<?xml version="1.0"?> <layout> <default> <reference name="content"> <block type="core/template" name="my_view_script" template="hello/world.phtml" /> </reference> </default> </layout> In the above code, a block with the Mage_Core_Block_Template object class will be added to the block named "content" (which, in your opinion, is the one you asked about). Magento will then look for the script view in the following places in the following order:
app/design/frontend/PACKAGE_NAME/THEME_NAME/template/hello/world.phtml app/design/frontend/PACKAGE_NAME/default/template/hello/world.phtml app/design/frontend/base/default/template/hello/world.phtml The first one found, the one that he will use. If there is no view of the script, Magento will log an error in var/logs/system.log (setting the default log file), indicating that the view of the script was not found. There will be no exit from the block.
Note that depending on your settings in System → Configuration → (General) Design there may be additional package/theme locations that Magento will look for. There are also other scenarios, for example, if the Custom Theme field is changed for individual CMS pages, catalog categories or catalog products, this page for viewing individual models may have an additional script location (which will correspond to the selected theme) that takes precedence over the settings by default your site.
Magento will follow the same backup logic when searching for translation files as well as XML markup files.
Please note that it is perfectly acceptable to copy individual view scripts (do not copy entire directories, copy only view scripts that you intend to change) from app/design/frontend/base/default/template/ to your local theme, and configure them for your own purposes website theme. However, in order to have a site compatible with the update, layout files should not be copied from the database to your local theme. This does not comply with update compatibility guidelines. Instead, XML app/design/frontend/PACKAGE_NAME/THEME_NAME/layout/local.xml updates for your theme should be contained in app/design/frontend/PACKAGE_NAME/THEME_NAME/layout/local.xml . There are no layout instructions from app/design/frontend/base/default/layout/* that cannot be deleted / added / changed, as you have, with the correct XML instructions in local.xml.