Я установил Joomla v3.4.7 для тестирования и подготовки моего проекта. Шаг за шагом я создал компонент «HelloWorld» согласно официальному учебнику [https://docs.joomla.org/J3.x:Developing_an_MVC_Component/Using_the_database][1] , и мне удалось отобразить список данных, а затем страницу редактирования добавлять или редактировать существующие данные, со стороны администратора, так же, какКак скопировать административный компонент Joomla как сайт один?
localhost/joomla-test/administrator/index.php?option=com_helloworld
После окончания этого, я просто скопировал файлы в /Administrator/components/com_helloworld
для /components/com_helloworld
и перезапись предыдущих файлов, и доступ к компоненту сайта:
localhost/joomla-test/index.php?option=com_helloworld
I t не работает! Я использовал firebug для отладки и получил
NetworkError: 500 Internal Server Error - http://localhost/joomla-test/index.php?option=com_helloworld
ошибка .... Что случилось?
Мой код:
сайта/helloworld.php:
<?php
// import joomla controller library
jimport('joomla.application.component.controller');
// Get an instance of the controller prefixed by HelloWorld
$controller = JControllerLegacy::getInstance('HelloWorld');
// Perform the Request task
$controller->execute(JFactory::getApplication()->input->getCmd('task'));
// Redirect if set by the controller
$controller->redirect();
сайт/controller.php
<?php
// No direct access to this file
defined('_JEXEC') or die;
// import Joomla controller library
jimport('joomla.application.component.controller');
/**
* General Controller of HelloWorld component
*/
class HelloWorldController extends JControllerLegacy
{
/**
* display task
*
* @return void
*/
protected $default_view = 'helloworlds';
public function display($cachable = false)
{
parent::display($cachable);
echo "controller";
return $this;
}
}
сайт/просмотров/helloworlds/view.html.php:
<?php
// No direct access to this file
defined('_JEXEC') or die;
// import Joomla view library
jimport('joomla.application.component.view');
/**
* HelloWorlds View
*/
class HelloWorldViewHelloWorlds extends JViewLegacy
{
/**
* HelloWorlds view display method
* @return void
*/
function display($tpl = null)
{
// Get data from the model
$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;
// Set the toolbar
$this->addToolBar();
// Display the template
parent::display($tpl);
}
/**
* Setting the toolbar
*/
protected function addToolBar()
{
JToolBarHelper::title(JText::_('COM_HELLOWORLD_MANAGER_HELLOWORLDS'));
JToolBarHelper::deleteList('', 'helloworlds.delete');
JToolBarHelper::editList('helloworld.edit');
JToolBarHelper::addNew('helloworld.add');
}
}
Пожалуйста, помогите, спасибо всем.