Overview
KB
Technical FAQ
PHP Manual
CSS2 Manual
HTML Manual
JS Guide
JS Reference
PhpDock Manual
Nu-Coder Manual
PhpExpress Manual
PHP Joomla
Development
Learn PHP
 
<Yaf_Dispatcher::dispatchYaf_Dispatcher::flushInstantly>
^Yaf_DispatcherLast updated: Mon, 26 Oct 2026

Yaf_Dispatcher::enableView

(Yaf >=1.0.0)

Yaf_Dispatcher::enableView — Enable view rendering

Description

public function Yaf_Dispatcher::enableView(): ?Yaf_Dispatcher

Turn on view rendering. This is the opposite of Yaf_Dispatcher::disableView().

Parameters

This function has no parameters.

Return Values

Returns the Yaf_Dispatcher object itself on success, or null if the application is not initialized.

Examples

Example #1 Yaf_Dispatcher::enableView() example

<?php
class ApiPlugin extends Yaf_Plugin_Abstract
{
    public function routerStartup(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response)
    {
        $dispatcher = Yaf_Dispatcher::getInstance();

        if ($request->getModuleName() === "Api") {
            // API actions emit JSON themselves, no view rendering wanted
            $dispatcher->disableView();
        } else {
            $dispatcher->enableView();
        }
    }
}
?>

See Also


<Yaf_Dispatcher::dispatchYaf_Dispatcher::flushInstantly>
^Yaf_DispatcherLast updated: Mon, 26 Oct 2026