Search code examples
joomlajoomla-extensionsrequire-once

How require_once in joomla2.5


I Have a problem about require_once in joomla.

In this file php:

components\com_test\views\__test_r5\tmpl\default.php

I want to include some file using this code:

require_once (JPATH_ROOT.DS.'/includes/General.php');

but require_once does not works


Solution

  • The path you are trying to include will evaluate to something like: joomla//includes/General.php. Notice the double slashes before "includes". The constant DS is defined to be a directory separator.

    Try:
    require_once (JPATH_ROOT.'/includes/General.php');
     (without DS)