user2636556
user2636556

Reputation: 1915

RenderPartial from Modules for index.php

I'm trying to call a view in my modules/moduleName/views/ab/_temp from my index.php file. but cant seem to get it to work.

in my side controller i have this

public function actionIndex()
    {
        $model=new Ab;

        $this->render('index',array(
            'model'=>$model
        ));
    }

in my views/site/index.php

<?php $this->renderPartial('//modulesName/views/ab/_temp', array('model'=>$model)); ?>

i'm getting this error

 include(Ab.php): failed to open stream: No such file or directory

Upvotes: 1

Views: 82

Answers (1)

javijuol
javijuol

Reputation: 388

If your controller is not inside the module you should import the path to your main.php file:

'import'=>array(
    ...,
    'application.modules.moduleName.*',
    'application.modules.moduleName.models.*',
),

Upvotes: 2

Related Questions