Yii Framework Forum: Load External Js File From Controller - Yii Framework Forum

Jump to content

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

Load External Js File From Controller Rate Topic: -----

#1 User is offline   charles07 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 20
  • Joined: 05-February 12

Posted 16 November 2012 - 12:03 AM

how to include js file in controller

ie. some thing like this

 public function actionIndex()
     {
                //load js file here
                $this->render('index');
     }

requirement is to load js file in a new page
0

#2 User is offline   charles07 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 20
  • Joined: 05-February 12

Posted 16 November 2012 - 12:26 AM

got it

Yii::app()->clientScript->registerScriptFile('scripts/myfile.js',CClientScript::POS_END);
0

#3 User is offline   charles07 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 20
  • Joined: 05-February 12

Posted 16 November 2012 - 12:59 AM

public function actionIndex()
{
            Yii::app()->clientScript->registerScriptFile('scripts/myfile.js',CClientScript::POS_END);
            $this->render('index');
}


i just wanted to load this file in a single page, if i load it in layouts/main.php page file would be loaded in entire site.
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