4

I am trying to transfer a Joomla 1.5 site to 3x series

Its having

// Set the table directory
JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_newtoy'.DS.'tables');
$controllerName = JRequest::getCmd( 'c', 'category' );


$task = JRequest::getCmd('task');
require_once( JPATH_COMPONENT.DS.'controllers'.DS.$controllerName.'.php' );
$controllerName = 'NewtoyController'.$controllerName;

In administration view - its creating below notice and error

( ! ) Notice: Use of undefined constant DS - assumed 'DS' in Warning: require_once(): failed to open stream


Fatal error: require_once(): Failed opening required ''

How to get this fixed for Joomla 3.6 series?

2 Answers 2

9

This is not coming from Joomla core, but from a 3rd party (likely custom developed) component that exist in your site.

First see if you really need/use this component, or you can simply uninstall it. If you need it, then look for any information you can gather for this component - find the developer and his site/email and ask if there is an update for Joomla 3. Such information you may be able to find in the component's files, e.g the newtoy.xml file in the component's directory of the administrator site.

If there is no such info or no upgrade, then you will have to upgrade it.

Regarding this specific error about the DS constant, you need to replace all "DS" occurrences with the forward slash "/" in the extension.

*The DS constant is no longer used in Joomla.

As a quick solution, you can define the DS constant at your own:

A. Create a defines.php at the root directory of your Joomla site.

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

// Custom definitions

define('DS', '/');

Joomla will load this defines.php file and the DS constant will be defined across the site application.

B. At the top of the main index.php with (it will be overwritten at next Joomla update):

defined('DS') or define('DS', '/');

C. At the top of your script:

defined('DS') or define('DS', 'DIRECTORY_SEPARATOR');

This will solve temporary this error, but this change will be lost with the next Joomla update.

But probably there will be more changes you will need to make in order to upgrade the component and make it compatible with Joomla 3.

If you have no programming experience, then this task won't be very easy and it might be a good idea to hire someone.

You may find the following resources useful:

2
  • thanks, but is define('DS', DIRECTORY_SEPARATOR); not going to be supported in future versions
    – Ruchika
    Jul 27, 2016 at 5:29
  • @MichaelYaeger nothing javascript in this post.
    – FFrewin
    Feb 1, 2017 at 16:43
3

I recommend you to use this plugin:

http://extensions.joomla.org/extension/ds-constant

it will reintroduce the deprecated DS constant to ease the migration for 2.5.x sites whose extensions still use DS until they get fixed by its developers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.