0

I am new to magento. I am using version 1.9.1. How can i call a phtml page as home page?

So far im making changes in cms->homepage->design im changing the html code there. But now i want to include php in the homepage src code. How can i do that?

3

It's very simple, don't need to develop extension for it.

Just go to your home page (cms page) and add this line anywhere you like:

{{block type="core/template" template="theme/your_path/file_name.phtml"  name="myname"}}

However, it will depend what kind of info you will be adding in this file.

  • I have to include this in cms->homepage->design only ryt? – user3041822 Jan 5 '16 at 12:26
  • this is not working? – user3041822 Jan 5 '16 at 12:38
1

Well you could go by module way.

Create your module's xml file as below:

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

And then the config.xml file should be:

<?xml version="1.0"?>
<config>
  <modules>
    <Yourcompany_Yourmodule>
      <version>1.0.0</version>
    </Yourcompany_Yourmodule>
  </modules>
  <global>
    <page>
      <layouts>
        <yourmodule translate="label">
          <label>Yourcompany_Yourmodule</label>
          <template>page/homepage.phtml</template>
          <layout_handle>home_page</layout_handle>
        </yourmodule>
        <!-- add more layouts here -->
      </layouts>
    </page>
  </global>
</config>

Now add to your CMS Page and edit.

Now go to your Magento back end admin. Go to CMS > Pages.

Now go to the CMS homepage, you should now have Home_page in your layout dropdown select it and save your page.

Now go back to your homepage.phtml and edit till your hearts content!

Refer below for more understanding.

http://naileditdesign.com/creating-custom-homepage-template-magento/

1

You can add the file like below. go to CMS->Pages and select Homepage.

Add following line to Content.

{{block type="core/template" template="theme/your_path/file_name.phtml"  name="your_name"}}

Ensure your path Correctly.

If you want to add some specific category only in home page. Use below code.Give the relevant category on category_id.

{{block type="catalog/product_list" category_id="3" template="catalog/product/list.phtml"}}

In the design choose appropriate layout for your home page.

You can find some more answer from this link for the same type of task

  • yes its working now.... But im getting it like iframe format? I am using rwd default theme but i can configure only from base/default/cms/default/home? If i use rwd/default/template its not working? – user3041822 Jan 5 '16 at 13:02
  • What is the layout u used? – Mujahidh Jan 5 '16 at 13:11
  • 2column with right bar.. – user3041822 Jan 6 '16 at 5:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.