Quantcast
Channel: Joomla! Forum - community, help and support
Viewing all articles
Browse latest Browse all 1028

Joomla! 5.x Coding • Converting J3 MVC component to J5

$
0
0
Can anyone please point me in the right direction for documentation that would help me convert a component I wrote originally using the tutorial http://docs.joomla.org/Developing_a_Mod ... t_-_Part_4 and which I need to update to get it to work in Joomla 5 ?

Here is some of the code I need to convert:

Code:

<?php/** * @package    Joomla.Tutorials * @subpackage Components * @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_4 * @license    GNU/GPL */// No direct accessdefined( '_JEXEC' ) or die( 'Restricted access' );// Require the base controllerrequire_once( JPATH_COMPONENT.'/controller.php' );// Require specific controller if requestedif($controller = JRequest::getWord('controller')) {$path = JPATH_COMPONENT.'/controllers/'.$controller.'.php';if (file_exists($path)) {require_once $path;} else {$controller = '';}}// Load Helper classrequire_once( dirname( __FILE__ ) . '/helper.php' );JRequest::setVar( 'layout', 'form'  );$task = JRequest::getVar( 'task' );if ($task == '') { JRequest::setVar( 'task', 'members'  ); } // set the task if it is not set.// Create the controller$classname= 'membersController'.$controller;$controller= new $classname( );// Perform the Request task$controller->execute( JRequest::getVar( 'task' ) );// Redirect if set by the controller$controller->redirect();?>
It fails at JRequest::getWord (and will probably fail at JRequest::getVar and JRequest::setVar).

Grateful thanks for any pointers, or if there's a new tutorial somewhere - I could only find tutorials for J2.5 and J3.

Thanks :-)

Brian

Statistics: Posted by bcraigie — Mon Aug 26, 2024 7:05 am



Viewing all articles
Browse latest Browse all 1028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>