My site has configured multilanguage, i develop now a small component and need physical path of my component, and if i use JPATH_COMPONENT_ADMINISTRATOR then i get still


How can I get really physical path? I tested also most of this constants, but no one works correctly, i need it exactly for external css file:

$doc = JFactory::getDocument();
$doc->addStyleSheet(JPATH_COMPONENT_ADMINISTRATOR . '/assets/css/component_style.css');
  • 1
    For an external CSS file, why not simply use the domain name? Using absolute paths for importing assets is not a good idea
    – Lodder
    Commented Oct 13, 2014 at 19:07

1 Answer 1


To load CSS and Javascript files, you want to use JUri::base() instead of JPATH_COMPONENT_ADMINISTRATOR.

Also have a look at a more advanced loading mechanism, JHtml.

Adding JavaScript and CSS to the page


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.