injected scripts and links in head ?

Hi

This is defenitly a beginers question

  • I create a new webapp with yiic

  • then generated the "message" sample with gii

  • which uses some modules

I noticed on

r=site the originale Site only the files in main.php layout are in the head tag

but on r=message I noticed some scripts and links are injected dynamicaly (jquery,style.css,pager.css…)

I can’t put my finger on the process behind this

I imagine this is caused by modules or widgets

Anyone with have a light bulb ?

Thanks

In some widgets where there is need to register some script files the CClientScript object is used.

You can obtain the cclientscript object used by your Yii app like


$cs = Yii::app()->clientScript;

and use functions like:

  • registerCoreScript() Registers a script package that is listed in packages.

  • registerCss() Registers a piece of CSS code.

  • registerCssFile() Registers a CSS file.

  • registerLinkTag() Registers a link tag that will be inserted in the head section (right before the title element) of the resulting page.

  • registerMetaTag() Registers a meta tag that will be inserted in the head section (right before the title element) of the resulting page.

  • registerPackage() Registers a script package that is listed in packages.

  • registerScript() Registers a piece of javascript code.

  • registerScriptFile() Registers a javascript file.

check documentation for full details.