Mustapha George
Mustapha George

Reputation: 2527

magento - where to put templates

I am following the Alan Storm Magento tutorials http://alanstorm.com/layouts_blocks_and_templates

In this tutorial he suggests creating an html template file at this location

app/design/frontend/base/default/template/simple_page.phtml

However templates look like they are grouped into additional directories by module name. Is this the current standard?

I am using Magento 1.6.2. I am not sure what version the tutorial is tested for.

* additional information *

I created a file called "local.xml" at this location app/design/frontend/base/default/layout/local.xml

that contains:

<layout version="0.1.0">
    <default>
        <reference name="root">
            <block type="page/html" name="root" output="toHtml" template="simple_page.phtml" />                         
        </reference>
    </default>
</layout>   

then file "simple_page.phtml" in directory:

app/design/frontend/base/default/template/

that contains:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>    
</head>
<body>
    <p>hello world</p>
</body>
</html>

After clearing cache, I get "white screen of death" on home page, however helloworld page works.

If I erase local.xml, front page comes back.

Upvotes: 2

Views: 159

Answers (2)

Mustapha George
Mustapha George

Reputation: 2527

Keep reading the tutorial... http://alanstorm.com/layouts_blocks_and_templates

"If you go to any other page in your Magento site, you’ll notice they’re either blank white, or have the same red background that your hello world page does. Let’s change your local.xml file so it only applies to the hello world page. We’ll do this by changing default to use the full action name handle (helloworldindexindex)."

<layout version="0.1.0">
    <helloworld_index_index>
        <reference name="root">
            <block type="page/html" name="root" output="toHtml" template="simple_page.phtml" />
        </reference>
    </helloworld_index_index>
</layout>

Upvotes: 0

Ren&#233; H&#246;hle
Ren&#233; H&#246;hle

Reputation: 27305

Here is a short Turorial but the main concept is that you make your own theme/template and overwrite the default templates.

So you can create under System -> configuration -> Design under the point Theme you change the default to your own theme name like "my_theme".

Rest you can see in the tutorial. You can put a folder with your theme name to

app\code\frontend\default\my_theme

Then you can copy the template from default with the same folder structure to your theme and magento take the template from your theme folder instead the default template.

Upvotes: 1

Related Questions