3

I want to know how the jquery resources loaded into the Joomla Protostar Template under Joomla 3.3. If I look into the code I see the jquery resources are loaded but in the index.php I cant find any code line. Can anyone tell how the jquery resources are loaded?

  • 1
    Why a negative vote? – user2025830 Aug 12 '14 at 11:02
4

jQuery automatically gets imported in noConflict mode when you use the following code:

JHtml::_('bootstrap.framework');

which also as you can probably figure out, loads the Bootstrap framework too.

You will see on line 38 of the index.php file in the Prosostar template folder

  • You can also change this to JHtml::_('jquery.framework'); if you do not want the bootstrap framework and just jquery. I think that is only in Joomla 3+ though but I could be wrong. – Jordan Ramstad Aug 12 '14 at 16:24
  • @Jordan, yes, you're correct. Only Joomla 3.x, but the Protostar template is part of Joomla 3.x so all is good :) – Lodder Aug 12 '14 at 18:25
  • Guess I will add, if you need to use jQuery use that code even if its being loaded somewhere else, it will only load once but if you add other scripts they will typically load above the framework unless it is above your scripts as well (mainly while using $doc->addScript($path)) – Jordan Ramstad Aug 12 '14 at 18:54
  • That's a whole new topic ;) – Lodder Aug 12 '14 at 18:57
2

In the section of my Protostar template I can see the following - can you not?

<script src="/media/jui/js/jquery.min.js" type="text/javascript"></script>
<script src="/media/jui/js/jquery-noconflict.js" type="text/javascript"></script>
<script src="/media/jui/js/jquery-migrate.min.js" type="text/javascript"></script>

There is also some documentation here that may help regarding Javascript frameworks and Joomla http://docs.joomla.org/J3.x:Javascript_Frameworks

See on line three;

To enable the Bootstrap framework, call JHtml::_('bootstrap.framework'). This will automatically enable the jQuery framework in noConflict mode (i.e. accessed via jQuery. instead of $.)

Hope this is clear and helps.

  • Yes, if you see in the html code then I can see this, but in the index.php the files are loaded from a different way – user2025830 Aug 12 '14 at 10:30
  • 1
    Ok, the answer was on the 3rd line of the documentation link I provided. – jonboy Aug 12 '14 at 10:43
  • I don’t understand the down vote because the answer is in the link you provide. I make a +1 and i suggest you add a quote from your link to your answer (« This will automatically enable the jQuery framework... ») – Sébastien Gicquel Aug 13 '14 at 9:52
  • I also don't understand the down vote? Seems like a helpful answer - thanks Sébastien – jonboy Aug 13 '14 at 10:04

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.