/** * Default view helper. Takes the same parameters as PicoraDispatcher::getUrl(), with text prepended. * #php * print self::link('Link Text',array('Blog','index')); */ public static function link($text, $controller_and_method, $arguments = false, $include_base_url = true) { return self::tag('a', array('href' => PicoraDispatcher::getUrl($controller_and_method, $arguments, $include_base_url)), $text); }
/** * Redirects to another method, and terminates the current request. * * Putting the word "Controller" at the end of each controller name is optional. * * self::redirect('about'); * self::redirect(array('BlogController','post'),array('post_id'=>5)); * self::redirect(array('Blog','post'),array('post_id'=>5)); * self::redirect('http://google.com/'); * @param mixed $controller_and_method String method name if redirecting to a method in the current controller or array('ControllerName','methodName') if redirecting to a method in another controller. * @param mixed $arguments Array arguments to resolve the route,or boolean false. */ public static final function redirect($controller_and_method, $arguments = false, $include_base_url = true) { header('Location: ' . (is_string($controller_and_method) && (strpos($controller_and_method, 'http://') === 0 || strpos($controller_and_method, 'https://' === 0)) ? $controller_and_method : PicoraDispatcher::getUrl($controller_and_method, $arguments, $include_base_url))); exit; }
public static function viewHelper() { return '<link rel="pingback" href="' . PicoraDispatcher::getUrl(array('PicoraXMLRPC', 'respondToXMLRPC')) . '" />'; }