Joomla! root directory

user497849 picture user497849 · Jan 26, 2012 · Viewed 7.1k times · Source

I have the following directory structure:

C:\mywebsites
  \site_1
  \site_2
  \site_n

In 'site_2' I have joomla installed, however, I have other folders with resources, php scripts, etc. in one of the 'extra' folders, I have scripts that I'm frequently calling, the trouble comes when I call JURI::base(), it returns the folder in which the script file is, in stead of 'site_2' which I'm expecting.

How can I overcome this simple task?

Answer

Craig picture Craig · Jan 27, 2012

The root directory is defined in JPATH_BASE.

It's set in the index.php in the Joomla front end and in the /administrator using:

define('JPATH_BASE', dirname(__FILE__));

JURI::base() returns the base request path.