How to find out Joomla root directory for use in files? I tried the following with no luck:
$path = JPATH_COMPONENT; //Gives component root $path = JURI::root(); //Gives absolute path, can't be used for some reason (http://www.site.com) $path = $_SERVER['DOCUMENT_ROOT']; //Gives public_html folder, but if someone installs joomla in a directory and not in root, it wrecks the whole thing
Is there a way to find only the root Joomla site? Thank.
maybe this can help you http://docs.joomla.org/Constants
Suppose you want to include an image from an image folder, you can just use this:
$image = JUri::root() . 'images/image_name.png';
JUri::root()and both JUri::site()always determine the root directory
JUri::root()
JUri::site()