Back to the module list

Output choosed by REST (REpresentational State Transfer)

The REST (REpresentational State Transfer) allow to return the display result to the user browser be choosing the best format. The user provide the format he would like and the REST module answer by translating in this format, if it is allowed.

The actual allowed formats are "json", "xml", "txt", "csv".

Use the browser parameter HTTP_ACCEPT to choose the format.

The class definition

Class \outputrest

Namespace \

Description

 Display in REST the data provided.
 Allow all the output types : JSON, XML, TXT...

Properties

No property available

Methods

public function out ($data, $title=false, $viewClass=false, $viewMethod=false, $layout=false, $replacement=array (), $variable=array (), $module="")
 Data is printed by viewClass->viewmethod, in the middle of $layout
 title is put in the title of the HTML page
 $replacement modify the result (it can do title too :
 array ("Output choosed by REST (REpresentational State Transfer)

"=>"title to display")
 @param mixed $data Data to display on the page
 @param string|null $title Title to put on head of page
 @param string|null $viewClass Class in views to use to display
 @param string|null $viewMethod Method in the class in views
 @param string|null $layout Layout file in views
 @param array|null $replacement Replace the {key}=>value
 @param array|null $variable PHP variables send to the view and to layout
                   (can be processed by foreach, if...)
 @param string|null $module The module name to use if needed
 @return Exit from PHP at the end of HTML display