How jquery is automatically loaded?

In layout main.php file the code is:


<link rel="stylesheet" type="text/css" href="/project/css/main.css" />

<link rel="stylesheet" type="text/css" href="/project/css/form.css" />

<title>.:: Hello ::.</title>

And when i run page in browser some other tags are automatically added.


<link rel="stylesheet" type="text/css" href="/project/css/main.css" />

<link rel="stylesheet" type="text/css" href="/project/css/form.css" />


<link rel="stylesheet" type="text/css" href="/project/assets/20222479/detailview/styles.css" />

<link rel="stylesheet" type="text/css" href="/project/assets/f0716c8e/mbmenu.css" media="screen" />

<script type="text/javascript" src="/project/assets/8a8ff0d0/jquery.js"></script>

<script type="text/javascript" src="/project/assets/8a8ff0d0/jquery.yii.js"></script>

<title>.:: Hello ::.</title>

This is for admin side. I have copied same structure for front side as well.

But jquery is not loaded. How this can be done?

After see your question, I thought same. I tried one demo and think got answer :)

Yii uses lazy loading it does not include things until the that is used( called ) for the first time.

you can try this demo.

Open the About page which is available with project setup.

see code using view source of that page ( this time you can see jQuery is not added ).

Now just put CJuiDatePicker code in about.php file and then,

see code using view source of that page ( this time you can see jQuery is added ).

again as you remove CJuiDatePicker code, and view source it does not include jQuery files from assets.

I hope this is the answer of your question. :rolleyes: