问题
Trying to migrate some of the custom components which works well in Joomla 2.5.14 to Joomla 3.1.5, however getting some errors like - 404 component not found in Joomla Backend & other errors in frontend
Is there any migration guide from Jooma 2.5 to 3x series, of what changes need to be done in custom components
Front End Section of Site 1st error
Notice: Use of undefined constant DS - assumed 'DS' in forms.php
2nd error
Warning: require_once(com_formsDScontroller.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory in forms.php
3rd error
Fatal error: require_once() [<a href='function.require'>function.require</a>]: Failed opening required 'com_formsDScontroller.php' (include_path='.;C:\php\pear') in forms.php
Been all errors showing forms.php, it is
<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
require_once( JPATH_COMPONENT.DS.'controller.php' );
if ($controller = JRequest::getWord('controller')) {
$path = JPATH_COMPONENT.DS.'controllers'.DS.$controller.'.php';
if (file_exists($path)) {
require_once $path;
} else {
$controller = '';
}
}
$classname = 'FormsController'.$controller;
$controller = new $classname();
$controller->execute( JRequest::getVar( 'layout' ) );
$controller->redirect();
?>
回答1:
Add the below line
defined( '_JEXEC' ) or die( 'Restricted access' );
if(!defined('DS')) define('DS', DIRECTORY_SEPARATOR);
From the docs
The DS constant has been removed. If you really need it you can use DIRECTORY_SEPARATOR instead.
Similar Question
来源:https://stackoverflow.com/questions/18502882/migrating-from-joomla-2-5-to-3x-generating-errors