magento 模板(主题)制作准备

来源:互联网 发布:淘宝店铺违规被关闭 编辑:程序博客网 时间:2024/04/28 10:17

1.下载安装最新版的magento(带演示数据)

2.下一个中文的包(我英文比较差,安装上去,要是想英文的在后台中也是很容易切换的)

3.在后台关闭缓存和开启debug 模式

        a.打开调试模式:直接把index.php 中的

if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {    Mage::setIsDeveloperMode(true);}#ini_set('display_errors', 1);


这两条语句变为有效

 

4.写一个用于测试的模块test(主要测试一些关键的输出)

a.新建文件夹  app\code\local\MyTest\Test\Block

app\code\local\MyTest\Test\controllers

app\code\local\MyTest\Test\etc

app\code\local\MyTest\Test\Model

b.新建一个配置文件内app\code\local\MyTest\Test\etc\config.xml容如下

<config><modules><MyTest_Test><version>0.1.0</version></MyTest_Test></modules></config>

c.创建一个配置文件app\etc\modules\MyTest_Test.xml内容如下:

<config>  <modules>    <MyTest_Test>      <active>true</active>      <codePool>local</codePool>    </MyTest_Test>  </modules></config>


这时候可以在后台system->configuration->advanced 中看到MyTest_Test模块

d.配置路由,编辑上面的config.xml 加上如下代码

<config>.....<frontend><routers><mytest><use>standard</use><args><module>MyTest_Test</module><frontName>test</frontName></args></mytest></routers></frontend>
............

e.新建一个控制器文件app\code\local\MyTest\Test\controllers\IndexController.php内容如下

<?php/* * Created on 2014-5-13 * * To change the template for this generated file go to * Window - Preferences - PHPeclipse - PHP - Code Templates */ class MyTest_Test_IndexController extends Mage_Core_Controller_Front_Action { public function indexAction() { echo "test"; } }?>

此时访问magento\index.php\test   可以看到页面输出test

f.新建一个布局文件app\design\frontend\base\default\layout\local.xml  内容如下

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

g.新建一个phtml文件app\design\frontend\base\default\template\test\test.phtml 内容如下

mmmmmmmmmmmmmm
 
h.修改IndexController.php内容如下
<?php/* * Created on 2014-5-13 * * To change the template for this generated file go to * Window - Preferences - PHPeclipse - PHP - Code Templates */ class MyTest_Test_IndexController extends Mage_Core_Controller_Front_Action { public function indexAction() { //echo "test";  $this->loadLayout();       $this->renderLayout();    } }?>

访问此时访问magento\index.php\test   可以看到页面输出mmmmmm到此就可以了,等到以后可以在local.xml加bolck 然后看各个phtml文件的输出



5.下载安装一个layoutview模块

到此准备工作已经完成

 

0 0