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
    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 '14 at 19:07
6

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, privacy policy and cookie policy

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