Yaf_Dispatcher::autoRender

(Yaf >=1.0.0)

Yaf_Dispatcher::autoRenderSwitch on/off autorendering

Açıklama

public Yaf_Dispatcher::autoRender(bool $flag = ?): Yaf_Dispatcher

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

Bilginize:

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

Bağımsız Değişkenler

flag

bool

Bilginize:

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

Dönen Değerler

Örnekler

Örnek 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);
}
}

}
?>

Yukarıdaki örnek şuna benzer bir çıktı üretir:

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top