<?php
class IndexController extends Yaf_Controller_Abstract
{
public function indexAction() {
$logined = $_SESSION["login"];
if (!$logined) {
$this->forward("login", array("from" => "Index")); // forward to the login action
return false; // this is important, it ends the current flow
// and tells Yaf not to auto-render
}
// other processes
}
public function loginAction() {
echo "login, redirected from ", $this->_request->getParam("from") , " action";
}
}
?>
The above example will output
something similar to:
login, redirected from Index action