0
我可以发布我的代码。它的工作控制器,也阻止文件,但模板文件无法正常工作。块模板文件没有在我的控制器中调用?
在这里发送代码。
<?xml version="1.0" ?>
<!--
/**
* Module Configuration
*
*@author Magento
-->
<config>
<modules>
<Magentostudy_News>
<version>1.0.0</version>
</Magentostudy_News>
</modules>
<frontend>
<routers>
<magentostudy_news>
<use>standard</use>
<args>
<module>Magentostudy_News</module>
<frontName>news</frontName>
</args>
</magentostudy_news>
</routers>
</frontend>
<layout>
<updates>
<magentostudy_news>
<file>news.xml</file>
</magentostudy_news>
</updates>
</layout>
<global>
<blocks>
<news><class>Magentostudy_News_Block</class></news>
</blocks>
</global>
</config>
我news.xml文件
<layout version="0.1.0">
<default>
<reference name="content"></reference>
</default>
<news_index_index>
<reference name="content">
<block type="news/news" name="news.slider" template="news/news.phtml"></block>
</reference>
</news_index_index>
<layout>
这是我的控制器文件
<?php
class Magentostudy_News_IndexController extends Mage_Core_Controller_Front_Action{
public function _construct(){
Mage::app()->loadArea($this->getLayout()->getArea());
$this->loadLayout();
$this->renderLayout();
}
public function indexAction(){
$cpBlock = $this->getLayout()->getBlockSingleton('Magentostudy_News_Block_News');
}
}
?>
这是我的阻止文件
<?php
class Magentostudy_News_Block_News extends Mage_Core_Block_Template{
public function _construct()
{
parent::_construct();
$this->setTemplate('news/news.phtml');
}
}
?>
告诉我在什么类型的问题这个文件?以及如何解决它?