What is the standard way to include a javascript file that is required application wide?
Page 1 of 1
Javascript How to.....
#1
Posted 09 November 2009 - 07:52 PM
I search for this as I know I have seen it on the forums, however the search here does not permit searching for the term "javascript"
What is the standard way to include a javascript file that is required application wide?
What is the standard way to include a javascript file that is required application wide?
#2
Posted 10 November 2009 - 12:55 AM
There are many ways.. You could:
1. Use CClientScript::registerScriptFile()
eg Yii::app()->clientScript->registerScriptFile(...)
*reference
You could put this straight into your layout file, or in a component set to autoload in the config file. Or in some event that fires on every browser request (havn't looked into these)
2. Put CHtml::scriptFile(..) in the layout file
*reference
1. Use CClientScript::registerScriptFile()
eg Yii::app()->clientScript->registerScriptFile(...)
*reference
You could put this straight into your layout file, or in a component set to autoload in the config file. Or in some event that fires on every browser request (havn't looked into these)
2. Put CHtml::scriptFile(..) in the layout file
*reference
http://php-thoughts.cubedwater.com - my bloggings about Yii
Share this topic:
Page 1 of 1

Help











