Programming Archives - Page 9 of 9 - Ian Carnaghan

How to add JavaScript to you view files using the Yii Framework

Add the JavaScript code as below to your view $js = Yii::app()->getClientScript();   $js->registerScript(   'my-javascript-id',   'var value...

Mar 22 · 22 sec read >

How to change the url for Yii::app()->homeUrl in Yii

Open the main configuration file protected/config/main.php Now in the main.php file we can assign a Action or Url to homeUrl _highlight = “\n\nreturn...

Mar 22 · 14 sec read >

How to set the Theme in the Yii Framework on the Fly

Yii::app()->theme = 'ThemeName'; The above code can be set anywhere in your Yii Application to change the current Theme.

Mar 22 · 4 sec read >

How to get the Attribute Label of a attribute in a Model using Yii Framework

Use the getAttributeLabel() method (available since v1.1.4) Code Example: Products::model()->getAttributeLabel('brand_id') The above example gets the attribute label for the brand_id attribute...

Mar 22 · 6 sec read >

How to Embed CSS into a View using the Yii Framework 1.1

This can be done using the registerCss() method of the CClientScript class. CClientScript manages JavaScript and CSS stylesheets for views.  registerCss()registers a piece of CSS code. Place code similar to the...

Mar 22 · 19 sec read >

How to delete a Cookie in Yii Framework 1.1

To delete all Cookies execute the following command: Yii::app()->request->cookies->clear(); To delete a specific cookie execute the command below, only...

Mar 22 · 9 sec read >