Joomla 3 helloworld component category

by Anthony   Last Updated August 12, 2016 08:06 AM

After i follow joomla "Developing an MVC Component" Document until step 15- "Adding ACL"

Link -

everything works,

then i tried add a new view "category",but not work,

here is my code:

in admin fields folder,i create a hellocategory.php most code same with helloword,just change

protected $type = 'HelloCategory';

 * Method to get a list of options for a list input.
 * @return  array  An array of JHtml options.
protected function getOptions()
    $db    = JFactory::getDBO();
    $query = $db->getQuery(true);
    // custom
    $query->select(' as id,#__categories.title as category,#__categories.extension as exten');
    $query->where($db->quoteName('extension') . ' LIKE '. $db->quote('com_helloworld'));
    // end custom
    $db->setQuery((string) $query);
    $messages = $db->loadObjectList();
    $options  = array();


class HelloWorldViewCategory extends JViewLegacy
     * Display the Hello World view
     * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
     * @return  void
    function display($tpl = null)
        // Assign data to the view
        $category = $this->get('Item');

        // Check for errors.
        if (count($errors = $this->get('Errors')))
            JLog::add(implode('<br />', $errors), JLog::WARNING, 'jerror');

            return false;

        // Display the view


<layout title="Category">
    <fieldset name="request">


<?php var_dump($category); ?>

output is Null

The Admin Menu works,but frontend can't get any items in that category data, is there any about develop single category view document or sample online? i tried google for solution four days,but still no idea, or the only way is get data from database? Many Thanks!

Related Questions

Error on save of articles and categories

Updated October 23, 2017 17:10 PM

Joomla custom fields in mod_articles_category

Updated February 28, 2018 19:10 PM

Smart Search truncate the results

Updated June 25, 2018 15:10 PM