denlau
denlau

Reputation: 1016

Adding custom home page with static blocks

I am currently working on a Magento 1.8 installation, where I want to make a home page, that is custom.

The editable areas in the home page, should be static blocks (so no possibility of editing content in the CMS > Pages editor).. How is that possible?

I can't find any layouts just for the home page - they're all for the CMS-pages as a whole..

Upvotes: 0

Views: 2354

Answers (3)

eyeonu
eyeonu

Reputation: 211

You can also call a phtml file that contains further functions:

{{block type="core/template" template="catalog/custom-home.phtml"}}

you can than add css and js files to your cms site via Layout Update XML field, eg:

css/custom.css skin_jsjs/jquery/plugin.js

Upvotes: 0

Smeagol
Smeagol

Reputation: 81

I prefer creating a new custom template altogether.

For example, in /app/etc/modules/ create a file called Custom_Home.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Custom_Home>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <Mage_Page />
            </depends>
        </Custom_Home>
    </modules>
</config>

Then create the following folders: app/code/local/Custom/Home/etc. In /etc, create a config.xml file:

<?xml version="1.0"?>
<config>
  <modules>
    <Custom_Home>
      <version>0.1.0</version>
    </Custom_Home>
  </modules>
  <global>
    <page>
      <layouts>
        <Home translate="label">
          <label>Home</label> <!-- The label that appears in the CMS Page layout dropdown -->
          <template>page/home.phtml</template><!-- The path to the new template -->
        </Home>  
      </layouts>
    </page>
  </global>
</config>

This will then add another page layout option when on a CMS page, and navigating to Design->Layout.

Of course you would need to create a home.phtml file to get the page to work properly. Then within home.phtml you could make calls to static blocks that wouldn't affect any other of the default Magento templates.

Upvotes: 2

Steve Robbins
Steve Robbins

Reputation: 13812

You can include static blocks in your CMS page with

{{block type="cms/block" block_id="foo_block"}}

Upvotes: 0

Related Questions