widget within module in Yii

Posted by Karolis on Stack Overflow See other posts from Stack Overflow or by Karolis
Published on 2010-04-08T04:15:46Z Indexed on 2010/04/08 4:23 UTC
Read the original article Hit count: 312

Filed under:
|

I'm trying to create a widget within the module and then load that widget from 'outside' of the module. More particularly I'm using user module written by someone else. I don't want to have a separate page for displaying a login form, therefore I tried to make a CPortlet/widget (confusion) displaying the login form. Basically, I've moved the code from LoginController into that widget. Then I try to display the widget on some random page by

<?php $this->widget('user.components.LoginForm'); ?>

However, I get an error

CWebApplication does not have a method named "encrypting".

in UserIdentity class in this line:

else if(Yii::app()->controller->module->encrypting($this->password)!==$user->password)

This happens, because I'm basically trying to execute this code within context of the app and not the module. Thus the "Yii::app()->controller->module" trick doesn't really work as expected.

  1. What am I doing wrong:-\
  2. Is there a better way to achieve this. I.e. display that login form in some other page, which is normally displayed by accessing login controller within user module (user/login) or is a widget the right way of doing it?

Thanks.

© Stack Overflow or respective owner

Related posts about yii

Related posts about php