如何在extjs中使用Yii变量

I want to use the Yii::app() variable in ExtJs like below:

Ext.create('Ext.Toolbar',{
    region:'north',
    contentEl:'northPart',
    height:32,
    items:[
      {
        text:'<?php echo Yii::app()->name ?>',
        iconCls:'bmenu'
      }
    ]
});

But it is not working.
How to achieve that?

what you are doing can be done if you put the string in an invisible DIV and then from ExtJS code, get the DIV html in a variable and use it in your code.

You can use http://docs.sencha.com/ext-js/4-1/#!/api/Ext.Class-cfg-singleton to get global configuration from web pages to your js for example put it on your php page

Ext.define('MyConf', {
    singleton: true,
    YiiAppName: '<?php echo Yii::app()->name ?>'
});

then you can use it like

Ext.create('Ext.Toolbar',{
    region:'north',
    contentEl:'northPart',
    height:32,
    items:[
      {
        text:MyConf.YiiAppName,
        iconCls:'bmenu'
      }
    ]
});