Javascript

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” :huh:

What is the standard way to include a javascript file that is required application wide?

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)

  1. Put CHtml::scriptFile(…) in the layout file

*reference