2

I am developing a new web site, for which I installed the latest version of Joomla, 3.1.1. I created a template from scratch, using the Twitter Bootstrap. I downloaded the latest version of Bootstrap, and loaded the related javascript in the index.php of my template.

While creating a carousel on one of my pages, I encountered a bug with the carousel indicators that were not reflecting the current picture. By investigating with Firebug, I realised that the bootstrap.min.js that was loaded on the page was not the one that I placed in /template/xxx/js, but another one in /media/jui/js, loaded by Joomla itself. And the one loaded by Joomla was an older version.

So I copied the latest version of bootstrap.min.js to /media/jui/js, and my carousel is now working perfectly. But (there is always a but), I now have some menus that don't work on the admin side of the site, using the default Isis template. If I put back the older version of bootstrap.min.js, they work again...

I would like to do one of these 2 things:

  • find a way to have Joomla load a different version of bootstrap.min.js for the admin side and the user side of the site
  • find a way to override the javascript loaded by Joomla from my template index.php

Any idea on how to achieve one or the other?

Thanks, Patrick

Patrick
  • 21
  • 2

4 Answers4

2

Joomla ships with a slightly modified version of Bootstrap, so you cannot exchange it with a newer version.

The best thing for you to do is to find a version of that carousel script for the Bootstrap version shipped with Joomla. Otherwise you'll get problems on any update.

nibra
  • 3,958
  • 2
  • 20
  • 34
  • You're right, it's not a good idea to replace the js file used by Joomla. I have abandoned this idea. – Patrick May 11 '13 at 15:30
2

You can override the media by placing a file at templates/<your_template>/js/jui/bootstrap.min.js. But as warned by nibra, there are some modifications in the JS that you'll need to apply in your environment to keep things working. As well, you'd then be using a version of the JS that isn't intended for what we're shipping in the core currently.

So, it's possible to cleanly do it, but there's a fair amount of risk involved.

Michael
  • 992
  • 8
  • 19
0

I found a solution that seems to be acceptable: I inserted a <script src=" line in the index.php of my template, to load the latest version of the bootstrap template. As a result, both versions of the bootstrap javascript are loaded, but the most recently loaded is used, and my carousel is working.

I don't expect this to create problems with other modules in Joomla, as I use only basic ones or new modules that I created myself. In any case, the menu module of Joomla was not compatible with bootstrap navbar, and I had to add a few jQuery lines to add the needed classes.

Rgds, Patrick

Patrick
  • 21
  • 2
0

remove JHtml::_('bootstrap.framework'); from your index.php of your template and add any version of bootstrap you want manually, no big deal....except you prolly have to change your entire template markup...

Django
  • 84
  • 4