- 7. API Reference
7.3. Opt_Output_Http class - 7.2.30. setTemplate()
« Previous - 7.3.1. getHeaders()
Next »
7.3. Opt_Output_Http class
Table of Contents
| Construct | Class |
|---|---|
| Implements | Opt_Output_Interface |
| Versions | since 2.0-dev7 |
This output sends the executed views as a HTTP response to the user. In spite of executing views, it provides also the HTTP header management functionality.
Some of the features require Open Power Classes
Opc_Visitclass in order to work.
The class defines six constants:
Opt_Output_Http::HTMLOpt_Output_Http::XHTMLOpt_Output_Http::FORCED_XHTMLOpt_Output_Http::WMLOpt_Output_Http::XMLOpt_Output_Http::TXT
These are the default content types for Opt_Output_Http::setContentType() method.
If the templates are written in the XML/HTML mode, the
render()method can be called only once, for one view, in this output system. The next attempt raises an exception. This prevents the script from generating an invalid script output from the valid XML templates. In order to create modular templates, please read the template modularization.
Usage
Using Opt_Output_Http is easy:
// Initialize the OPT $tpl = new Opt_Class; // Create the view $view = new Opt_View('template.tpl'); $view->data = $someData; // Render the view $out = Opt_Output_Http; $out->render($view);
- 7.3. Opt_Output_Http class
7. API Reference - « Previous
7.2.30. setTemplate() - Next »
7.3.1. getHeaders()