Yii2: Include View Specific JavaScript

To include JavaScript for specific action, either the JavaScript code or file is to be registered in view file. Method 1: Register JavaScript File Use registerJsFile(). Note: optional position. values: POS_HEAD, POS_BEGIN, POS_END. …

Yii: Include view specific CSS

This is useful to define a CSS file specifically for a page and not overloading everything in a single CSS file. In /path/to/views/view_file.php:

Yii: Rendering a view

The following codes are called from view files, and assume the file to be included is named partial.php. To render a view from the current controller, ie view files are …