【发布时间】:2013-09-19 23:20:32
【问题描述】:
我知道周围有几个类似的主题,但我阅读并尝试了其中的大部分,但仍然无法弄清楚如何做到这一点。
我在 Joomla 2.5 中编写了一个组件,到目前为止它可以工作。我有不同的视图,我可以使用 controller.php 加载视图。 其中一个视图显示了我的数据库中的一个表(关于团队的数据)。
现在我想要另一个相同视图的布局,它将数据库表显示为表单,以便更改内容。
这就是文件结构:
观看次数/
- 团队/
- - tmpl/
- - - default.php
- - - 修改.php
--view.html.php
view.html.php 文件中没有:
...
// Overwriting JView display method
function display($tpl = null) {
...
$this->setLayout('modify');
echo $this->getLayout();
// Display the view
parent::display($tpl);
}
我尝试了 setLayout、$tpl = ...、default_modify.php 等的不同组合。 但我总是要么得到默认布局,要么得到一些错误,比如“找不到布局修改”
我使用 .../index.php?option=com_test&task=updateTeams 加载网站
controller.php 看起来像这样:
function updateTeams(){
$model = $this->getModel('teams');
$view = $this->getView('teams','html');
$view->setModel($model);
$view->display();
}
【问题讨论】:
标签: php templates joomla joomla2.5 joomla-component