【发布时间】:2013-02-09 16:47:20
【问题描述】:
我是 MVC 和 php 的新手。现在在magento app/code/core/Mage/Review/Model/Review.php
我添加代码。
public function mgtest(){
return 'hello world!';
}
在课堂上
class Mage_Review_Model_Review extends Mage_Core_Model_Abstract
{ }
在magento cms页面,我添加代码:
{{block type="core/template" name="review" template="catalog/product/reviewall.phtml"}}
url 键是 review.html
然后添加文件reviewall.phtml(app/design/frontend/default/mytheme/template/catalog/product/reviewall.phtml)
然后在其文件中添加测试代码。
<?php echo $this->mgtest();?>
当我访问网址时。 mysiteurl/review.html。没有 hello world 输出。为什么?谢谢。如何纠正它?模型中的所有文件是做什么的?如果我想调用 phtml 文件的函数。我该怎么办?
【问题讨论】: