Tuesday, March 27, 2018

Where are things in YII

Constants can be created and accessed in a controller with

const YEAR = '2018';

then accessed with

self::YEAR

In a Yii app, place constants in config/main.php

'params'=>array(
// this is used in contact page
                'year_senate'=>'2018',
),

then access it with

Yii::app()->params['year_senate']


No comments:

Post a Comment

Followers