Reading list Switch to dark mode

    Resolve the error “Use of undefined constant DS” of require_once method in Joomla 3.0

    Updated 15 October 2012

    In Joomla 1.5 to 2.5 we include directly the helper file or other file in the Joomla PHP code using require_once() method but in Joomla 3.0 you must defined the DS directory separator constant otherwise you getting error message.

    defined('_JEXEC') or die('Restricted access');
    require_once (dirname(__FILE__).DS.'helper.php');

    Here is the right way to import your file using the DIRECTORY_SEPARATOR constant

    defined('_JEXEC') or die('Restricted access');
    if(!defined('DS')){
        define('DS',DIRECTORY_SEPARATOR);
    }
    require_once (dirname(__FILE__).DS.'helper.php');

     

    Start your headless eCommerce
    now.
    Find out More
    . . .

    Leave a Comment

    Your email address will not be published. Required fields are marked*


    Be the first to comment.

    Back to Top

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home