gpt4 book ai didi

joomla - Joomla组件开发: Invalid controller: name ='' ,格式=''

转载 作者:行者123 更新时间:2023-12-04 13:28:11 24 4
gpt4 key购买 nike

我正在尝试从here开发组件。我在管理部分出现错误

500 - An error has occurred.

Invalid controller: name='', format=''



如何调试呢?我什至不知道与发布有关的代码。

文件:admin/controller.php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');

// import Joomla controller library
jimport('joomla.application.component.controller');

class TestimonialsController extends JController {
function display($cachable = false) {
// set default view if not set
JRequest::setVar('view', JRequest::getCmd('view', 'Testimonials'));

// call parent behavior
parent::display($cachable);
}
}

文件:admin/testimonials.php
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');

jimport('joomla.application.component.controller');
$controller = JController::getInstance('Testimonials');
$controller->execute(JRequest::getCmd('task'));
$controller->redirect();

文件:admin/views/testimonials/view.html.php
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');

// import Joomla view library
jimport('joomla.application.component.view');

class TestimonialsViewTestimonials extends JView {
function display($tpl = null) {
$items = $this -> get("Items");
$pagination = $this -> get("Pagination");

//Check for errors
if (count($errors = $this->get('Errors')))
{
JError::raiseError(500, implode('<br />', $errors));
return false;
}

// Assign data to the view
$this -> items = $items;
$this -> pagination = $pagination;

// Display the template
parent::display($tpl);

}
}

最佳答案

@mrN:xml文件呢?您可以验证 部分是否具有所有存档。

缺少文件时错误500的示例:

<!-- file testimonials.xml -->
<!-- ERROR 500 because <em>admin/controller.php</em> is not installed -->
...
<administration>
<!-- Administration Menu Section -->
<menu>Testimonials</menu>
<!-- Administration Main File Copy Section -->
<!-- Note the folder attribute: This attribute describes the folder
to copy FROM in the package to install therefore files copied
in this section are copied from /admin/ in the package -->
<files folder="admin">
<!-- Admin Main File Copy Section -->
<filename>index.html</filename>
<filename>testimonials.php</filename>
<!-- SQL files section -->
<folder>sql</folder>
</files>
</administration>
...

关于joomla - Joomla组件开发: Invalid controller: name ='' ,格式='',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12839871/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com