GoLang Yaf_Dispatcher::autoRender

request it (343)
GoLang replacement for PHP's Yaf_Dispatcher::autoRender [edit | history]



Do you know a GoLang replacement for PHP's Yaf_Dispatcher::autoRender? Write it!

PHP Yaf_Dispatcher::autoRender

PHP original manual for Yaf_Dispatcher::autoRender [ show | php.net ]

Yaf_Dispatcher::autoRender

(Yaf >=1.0.0)

Yaf_Dispatcher::autoRenderSwitch on/off autorendering

Description

public Yaf_Dispatcher Yaf_Dispatcher::autoRender ([ bool $flag ] )

Yaf_Dispatcher will render automatically after dispatches a incoming request, you can prevent the rendering by calling this method with flag TRUE

Note:

you can simply return FALSE in a action to prevent the auto-rendering of that action

Parameters

flag

bool

Note:

since 2.2.0, if this parameter is not given, then the current state will be renturned

Return Values

Examples

Example #1 Yaf_Dispatcher::autoRender()example

<?php
class IndexController extends Yaf_Controller_Abstract {
     
/* init method will be called as soon as a controller is initialized */ 
     
public function init() {
         if (
$this->getRequest()->isXmlHttpRequest()) {
             
//do not call render for ajax request
             //we will outpu a json string
             
Yaf_Dispatcher::getInstance()->autoRender(FALSE);
         }
     } 

}
?>

The above example will output something similar to: