Search code examples
export-to-excelyii-extensions

yii shows error file not found at given location


i am trying to export excel file using eexcelview extention in yii i am having following code with me

public function behaviors(){
        return array(
            'eexcelview'=>array(
               'class'=>'extensions.eexcelview.EExcelBehavior'
            ),
        );
}

and one more

public function actionTest()
    {
        // Load data
        $model = Customer::model()->findAll();

        // Export it
        $this->toExcel($model, array(
                'custid',
                'custname'
            ),
        'Test File',
        array(
            'creator' => 'Zen',
        ),
        'Excel2007' // This is the default value, so you can omit it. You can export to CSV, PDF or HTML too
        );
    }
    } 

as given on toexcel extension documentation

i am having eecxcelview folder and EExcelBehavior file at extensions/eexcelview/EExcelBehavior.php location

but i am having following error while executing the code

Alias "extensions.eexcelview.EExcelBehavior" is invalid. Make sure it points to an existing PHP file and the file is readable.

please help me as I am new to yii and I am using yii 1.0 .


Solution

  • Try to referencing extension folder as "ext". Try the following:

    'eexcelview'=>array(
               'class'=>'ext.eexcelview.EExcelBehavior'
            ),