Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Joomla component Development: Invalid controller: name='', format=''

I am trying out to develop components from here. I am getting an error on the admin section

500 - An error has occurred.

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

How to debug this? I dont even know what code is relevant to post.

File: 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);
    }
}

File: 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();

File: 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);

    }
}
like image 946
mrN Avatar asked Oct 11 '12 12:10

mrN


1 Answers

@mrN: What about the xml file? You can verify the sections <files> have all archives.

Example of error 500 when a file is missing:

<!-- 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>
...
like image 162
morrizon Avatar answered Dec 08 '22 06:12

morrizon