I was reading this forum post which says why redirecting from the widget is a bad MVC practice but may be good from the DRY point of view.
Forget for the moment, good or bad - the question is how do i actually redirect from a widget ?
yields the error:
thanks for the help
It should be
What does "site/confirmsubscription" mean?
is not working…
site/confirmsubscription is the controller/action respectively.
the problem is, this widget is located on several controller induced pages.
So the widget may be accessed from any controller.
Then the redirect method should be declared in the following way.
or additional Parameters should be appended like below.
$this->owner->redirect(array('site/confirmsubscription','id'=>$this->id));//or $model->id like so.
thanks for replying.
unfortunately that doesnt work
If i access the widget from a say another page say from user/login,
it redirects to /user/site/confirmsubscription instead of /site/confirmsubscription
resulting in a 404 error
I created a widget and put it inside the components folder.
class RedirectWidget extends CWidget
public function run()
At any controller if I call the widget like below, it redirects to login page.
One more suggestion is to put a forward slash at the beginning.
ha that backslash did the trick
it is late night or rather wee hours in India…
like me, you too seem to be nocturnal
thanks once again