Shortcut Function

Hi guys, how can I make a shortcut function for this Yii::app()->params[$name]?


function p($name=null){



	return $params;

  return $params[$name];


Hi thanks for the reply

i tried to use this one but it does not display the array. i have this array



                'charset'=>'text/html; charset=utf-8',


                'robots'=>'index, follow')

check the output


also, the values you mentioned must be in the config in the index "params"

this is my actual code


is your config like this ?

return array(











if yes, p(‘metaName’) should return an array containing the language

nope. this is my config



                'charset'=>'text/html; charset=utf-8',


                'robots'=>'index, follow')

the "params" component must be in configured like I said above, at the "params" index of the config

when you change to be like that, it will work as you expect

ah ok thanks.

about my config? how can i make a shortcut for that to work?

you can’t

the configuration options you set there are the configuration for the Yii Application, either web or console

Here is a list of the options you can set for a web application

As for your own parameters, define like you were doing, as params of the application

I see… thanks for the help bro…

Glad I could