I’ve module called User which contains widget in its components folder. The widget extends CActiveForm and used to display a login block in a sidebar on every page of site. Login action is handled by a UserController which resides in User module.
I set action element of my widget like this:
public function init()
{
$this->action = array('user/user/login');
}
This works on all pages EXCEPT those which handled by User module, e.g. in ‘user/user/login’ page I have my form action ‘user/user/user/login’, because module name is also prepended.
[list=1]
[*]How should I avoid this problem?
[*]Is it appropriate to use Widget to display a login block?
Alternative to adding a slash would be to make use of the createUrl() method in the web app or the controller. Using a Widget to display a login box is appropriate, it’s either that or a partial at the end of the day.
Thanks for replies. By the way, what is the difference between ‘action/controller’ and ‘/action/controller’? When should I use “slashed” version? I read the sources, but wasn’t able to figure it out.