JSONFormatter example

switch ($format) {
            case 'html':
                $data['styles'] = [];
                extract($data);
                $parser = Services::parser($this->config->viewsPath, null, false);
                ob_start();
                include $this->config->viewsPath . 'toolbar.tpl.php';
                $output = ob_get_clean();
                break;

            case 'json':
                $formatter = new JSONFormatter();
                $output    = $formatter->format($data);
                break;

            case 'xml':
                $formatter = new XMLFormatter();
                $output    = $formatter->format($data);
                break;
        }

        return $output;
    }
}
Home | Imprint | This part of the site doesn't use cookies.