日期:2014-05-17  浏览次数:20651 次

为我们的Hello World模块创建一个简单的HTML模板(magento)

为我们的Hello World模块创建一个简单的HTML模板。首先我们要创建如下文件

app/design/frontend/default/default/layout/local.xml

包含以下内容

<?xml version="1.0" encoding="UTF-8"?>

<layout version="0.1.0">

??? <helloworld_index_index>

??????? <reference name="root">

??????????? <block type="page/html" name="root" output="toHtml" template="helloworld/simple_page.phtml"/>

??????? </reference>

??? </helloworld_index_index>

</layout>

再创建如下文件

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

包含以下内容

<!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>

??? <title>Untitled</title>

??? <style type="text/css">

??????? body {

??????????? background-color:#f00;

??????? }