Joomla - MVC: Reorganizing Back End Code



Joomla Back End MVC Step By Step Tutorial - Part 1: Return we talk again aboutJoomla with the MVC viewpoint. We have learned the Joomla MVC at this post as starting point. That Tutorial focus the side front-end. In this post, we will study how to apply it at the back end side. We will reorganize the code use MVC.

We still work with our hello component. First, we will modify code which joomla execute for first time. I bet you know. Yes, admin.hello.php (if you still don't know, you can read from first at here). Ok, open your admin.hello.php within Joomla\administrator\components\com_hello. Replace with following code:

joomla mvc back end side

<?php
defined( '_JEXEC' ) or die( 'Restricted access' );

require_once(JApplicationHelper::getPath('admin_html'));
require_once(JPATH_COMPONENT.DS.'controller.php');
JTable::addIncludePath(JPATH_COMPONENT.DS.'tables');

$controller = new HelloController(
                  array('default_task'=>'showHellos'));
$controller->execute( JRequest::getVar('task') );
$controller->redirect();

?>

Next, we will talk about controller at back end.



Series this article:
Joomla - MVC: Reorganizing Back End Code
Joomla - MVC: Creating Controller and Model for Back End
Joomla - MVC: Creating View for Back End
Joomla - MVC: Adding Pagination for Back End
Joomla - MVC: Adding Element Paginating for Back End
Joomla - MVC: Creating Form Input Data for Back-End
Joomla - MVC: Saving Data for Back End
Joomla - MVC: Editing Data for Back-End
Joomla - MVC: Adding Delete Function at Back-End
Joomla - MVC: Controlling Publish State for Back-End


Tag: joomla, MVC, pattern, component Category: PHP Framework Post : February 06th 2008 Read: 5,496 Bookmark and Share

blog comments powered by Disqus