Multiple Frontends for component

Discussion and education for beginner / novice programmers interested in embarking on the development process to take advantage of the extensible nature of the Joomla! CMS.

Moderators: tjay, seadap, Rogue4ngel, matthewhayashida

Forum rules
Post Reply
mrigor
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Fri Feb 22, 2008 9:27 pm

Multiple Frontends for component

Post by mrigor » Thu Mar 06, 2008 7:26 pm

I am writing a custom component to display the roster and schedule for a football team. There are multiple teams and obviously multiple schedules. Due to the relationship, I created a single component that allows for the creation/management of teams, players, and schedules on the administrator side. It works great.

My problem, I now do not know how to display two different views for the same component. One for schedules and one for the rosters. My vision is to use a controller that accepts an extra parameter in the get bar and then decides which view to load. I have implemented this on the backend piece, but I am not able to complete it on the front-end. I could honestly be missing something, I am new to Joomla, OOP, etc and sometimes simple things escape me.

Any assistance would be greatly appreciated. I have been using a book called, Learning Joomla! 1.5
Extension Development by Packet Publishing which has been a great help. If there is a resource to help me along with this then I am open for suggestions as well.

Thanks,

Matt

radiant_tech
Joomla! Apprentice
Joomla! Apprentice
Posts: 41
Joined: Sat Dec 15, 2007 3:02 pm
Location: Washington DC Metro

Re: Multiple Frontends for component

Post by radiant_tech » Sat Mar 15, 2008 3:49 pm

I'm assuming you are writing this for J! 1.5.x.

You have the right idea as far as the controller is concerned. Your display() method in the controller could look something like:

Code: Select all

function display() {
    $view = JRequest::getVar('view');
    JRequest::setVar('view', $view);
    parent::display();
}
Then create a view for schedules and a view for rosters. The above controller code would assume the template files for each view are named default.php.
Denise


Post Reply