I am building a joomla component called event, and I set a menu called event linked to this component. When I clicked on the menu link, it directed me not to the default event listing page, but the event registration page. I wonder what is wrong.
Here is the controller.php
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import Joomla controller library
jimport('joomla.application.component.controller');
class EventController extends JControllerLegacy
{
function display() {
$this->listing();
}
function listing() {
JRequest::setVar( 'view', 'listing' );
JRequest::setVar( 'layout', 'default' );
parent::display();
}
function edit() {
JRequest::setVar( 'view', 'edit' );
JRequest::setVar( 'layout', 'default' );
parent::display();
}
function save() {
$model= & JModelLegacy::getInstance('Event','EventModel');
$model->save_event();
}
function register() {
JRequest::setVar( 'view', 'register' );
JRequest::setVar( 'layout', 'default' );
parent::display();
}
function register_save() {
$model= & JModelLegacy::getInstance('Event','EventModel');
$model->register_event();
}
}//end
The menu link is
http://www.example.com/Joomla_3.2.1/index.php?option=com_event&view=register&Itemid=481
instead of
http://www.example.com/Joomla_3.2.1/index.php?option=com_event
which is by default showing the listing page.