0

I have a problem, when I try to use a outer script that uses jquery like some caruslle script that I have. I got a layout and I want to transform it into yii and it has some scripts that use jquery like carousels and so on.

Now yii automatically embeds jquery. The problem is that if I embed jquery by hand, the scripts work but the yii scripts don't. And if I don't embed the jquery, the yii scripts work (like ajax validation) and my scripts don't. So like this: mine works

<link rel="stylesheet" type="text/css" href="/kav4/assets/8ff498f/css/redmond/jquery-ui.css" />
<script type="text/javascript" src="/kav4/assets/91eebf0f/jquery.js"></script>
<script type="text/javascript" src="/kav4/assets/91eebf0f/jquery.yiiactiveform.js"></script>
<script type="text/javascript" src="/kav4/assets/8ff498f/js/jquery-ui.min.js"></script>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery-ui.min.js"></script>

and like this: yii works

<link rel="stylesheet" type="text/css" href="/kav4/assets/8ff498f/css/redmond/jquery-ui.css" />
<script type="text/javascript" src="/kav4/assets/91eebf0f/jquery.js"></script>
<script type="text/javascript" src="/kav4/assets/91eebf0f/jquery.yiiactiveform.js"></script>
<script type="text/javascript" src="/kav4/assets/8ff498f/js/jquery-ui.min.js"></script>
itayw
  • 614
  • 9
  • 20
Amir Bar
  • 3,007
  • 2
  • 29
  • 47
  • What is the "outer script that uses jquery"? What version of jquery it loads and what version "outer script" needs? It's weird that second code snippet doesn't work. What is a javasctipt error? – rinat.io May 02 '12 at 08:07
  • @amir bar, Did you solve this issue? i am also facing the same problem? – Suriyamoorthy Baskaran Oct 11 '12 at 07:07

1 Answers1

0

you can check my answer here If you include 2 version of jQuery in a page how do you restrict a plugin to just one of them?

It shows how to include two different versions of jquery in same page

Community
  • 1
  • 1
Milan Jaric
  • 5,556
  • 2
  • 26
  • 34
  • tnx but its not helping me because i have no control over yii scripts and i know noting about jquery :/ – Amir Bar May 01 '12 at 21:45
  • 2
    @amirbar "i know noting about jquery" = that's excuse! you can't expect anyone to do your homework instead of you. Everyone in stackoverflow is willing to help you but not work instead of you. Find your college if you are working in team who knows about jquery and javascript and I'm sure you will fix this. – Milan Jaric May 01 '12 at 21:52
  • i am sorry if it look like i want someone to do my homework, its just that it making no sense that in one version this script work and in another version that script work, its sound like a bug because its should be Backward compatibility – Amir Bar May 01 '12 at 21:59
  • I'm not judging you, just saying don't make excuses. Anyway, the reason of your problem is that you are loading 2 versions of jquery, and by looking at the order of script imports it will extend first instance of jquery with YII and then next script tag will include another jquery and overwrite all extensions (plugins) which was included previously, that is why you can't use YII, if you don't need last jquery.min.js and jquery.ui then remove those includes, especially if you don't care which version of jquery you need. – Milan Jaric May 01 '12 at 22:21