How to create a custom home page?
Question
I need to create a custom page to the homepage of my ecommerce. In it, I will insert static blocks and html content.
Can anyone tell me what to do to create a PHTML or XML template and call it on the homepage?
Solution
Be default a CMS page (url key home) is displayed. It has a WYSIWYG editor you can use and a tab where you can add Layout XML.
Optionally you add a local.xml
to your template and add the handle cms_index_index
to add content via layout XML.
The phtml files you might want to include can be put in the template directory with the other template files, you could make a directory home
or something like that to put them together
OTHER TIPS
Additionally you can call a template file from within your CMS page
{{block type="core/template" template="custom/homepage.phtml"}}
Where custom/homepage.phtml
is in app/design/frontend/[your design package]/[your theme]/template/custom/homepage.phtml
.
From within that template you can call static blocks with
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('your_static_block_id')->toHtml() ?>