Migrating from Joomla 2.5 to 3x Generating Errors

只愿长相守 提交于 2019-12-25 11:14:27

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!