Yii Framework Forum: Javascript - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Javascript How to..... Rate Topic: -----

#1 User is offline   George 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 16
  • Joined: 09-November 09

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

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

#2 User is offline   jonah 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 733
  • Joined: 27-November 08
  • Location:California (US)

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
http://php-thoughts.cubedwater.com - my bloggings about Yii
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users