\Disco\classesController

Provides some simple functionality to controllers for returning requests. Using these methods short circuits the request, aka terminates it immeditatly, not allowing other routes or controllers to be executed.

Summary

Methods
Properties
Constants
ajax()
json()
template()
html()
simple()
file()
xfile()
download()
xdownload()
redirect()
abort()
error()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

ajax()

ajax(string  $html) 

HTML to add to the view and return as a AJAX response.

Parameters

string $html

HTML to load into the view.

json()

json(array|\stdClass  $data) 

Return a JSON response.

Parameters

array|\stdClass $data

An array or stdClass to encode and return.

template()

template(string  $template, array  $data = array()) 

A template to add to the view and return.

Parameters

string $template

The template name to load into the view.

array $data

The data to bind into the template. Defaults to empty array.

html()

html(string  $html) 

Add HTML to the view.

Parameters

string $html

HTML to load into the view.

simple()

simple(string  $string) 

Echo a string without loading it into the view.

Parameters

string $string

The simple string response.

file()

file(string  $file) 

Serve a file as a resouce for use by the browser eg: css,js,png,jpg,jpeg files.

Parameters

string $file

The file to serve.

xfile()

xfile(string  $file) 

Serve a file as a X-resouce for use by the browser eg: css,js,png,jpg,jpeg files.

Parameters

string $file

The file to serve.

download()

download(string  $file) 

Serve a file as a download.

Parameters

string $file

The file to make available for download.

xdownload()

xdownload(string  $file) 

Serve a file as a download using XSendFile apache module.

Parameters

string $file

The file to make available for download.

redirect()

redirect(string  $path) 

Redirect the request to a different path.

Parameters

string $path

The new path.

abort()

abort(boolean|string|\Closure  $action = false) 

Abort the request with a 404.

Parameters

boolean|string|\Closure $action

Optional template or Closure function.

error()

error(integer  $code = 500, boolean|string|\Closure  $action = false) 

Abort the request with an error, default is 500.

Parameters

integer $code

The error code to return in the response.

boolean|string|\Closure $action

Optional template or Closure function.