how to I find out the Joomla root directory to 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 the joomla root of the site only? Thanks.
may be this can help you http://docs.joomla.org/Constants
Let's say you want to include an image from the images folder, you can simply use this:
$image = JUri::root() . 'images/image_name.png';
JUri::root()
and both JUri::site()
always define the root directory
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With