Take the 2-minute tour ×
Joomla Stack Exchange is a question and answer site for Joomla! administrators, users, developers and designers. It's 100% free, no registration required.

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');
share|improve this question
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 15 hours ago

1 Answer 1

up vote 4 down vote accepted

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

share|improve this answer
1  
Your method was helpful :), many thanks. –  jExchange 14 hours ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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