向自定义Joomla组件添加新视图
我正在尝试向自定义组件添加新视图。我已经照此做了,但我不太清楚说明 这就是我所做的: 我复制了另一个视图(称为plandetails)的结构 所以现在我有:向自定义Joomla组件添加新视图,joomla,joomla2.5,Joomla,Joomla2.5,我正在尝试向自定义组件添加新视图。我已经照此做了,但我不太清楚说明 这就是我所做的: 我复制了另一个视图(称为plandetails)的结构 所以现在我有: site controllers helpers language models views controller.php billingdetails.php //new controller plandetails.php //previous controller plandetails //previous view
site
controllers
helpers
language
models
views
controller.php
billingdetails.php //new controller
plandetails.php //previous controller
plandetails //previous view
tmpl
default.php
metadata.xml
view.html.php
billingdetails //new view
tmpl
default.php
view.html.php
我将billingdetails.php控制器更改为与plandetails.php相同,但使用了billingdetails实例:
defined('_JEXEC') or die;
// Include dependancies
jimport('joomla.application.component.controller');
// Execute the task.
$controller = JController::getInstance('Billingdetails');
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->redirect();
我使用适当的类更改了billingsdetails文件夹中的view.html.php:
class BillingdetailsViewBillingdetails extends JView
{
// Overwriting JView display method
function display($tpl = null)
{
// Display the view
parent::display($tpl);
}
}
现在在我的default.php(在billingdetails视图文件夹内)中,我只回显“TESTING”。如果我转到视图名为:mysite.com/index.php的组件,option=com\u plandetails&view=billingdetails
我得到这个错误:
未找到视图[名称、类型、前缀]:账单明细、html、计划明细视图
注意:我没有对模型做任何更改,因为我认为没有必要这样做。我想对这个视图重复使用相同的方法
我还缺少什么?视图的类名应该是组件名、单词视图,然后是视图名。因此,正确的视图类如下所示:
class plandetailsViewBillingdetails extends JView