3

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

http://example.com.com/LANGUAGE_STRING/administrator/components/com_mycomponent...

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
  • 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
    Oct 13, 2014 at 19:07

1 Answer 1

7

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

0

Your Answer

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

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