PAGE Methods

mime()

Allows you to get or to manually set the pages MIME Type. If you use the approriate prefix for your template, the setting will be done automatically. If you wish to change the output's content-type use the header() function in connection with this function and see our example below. See the download() function which provides an opportunity to download files.

string mime( string filetype [, bool set = true ])

Return

Sets the page's MIME Type

Parameter
Description
filetypeThe filetype can be a file extension as well as the whole filename
setSet MIME Type, if FALSE function will return a string showing the type's setting

Get page's current MIME type

$PAGE->mime()
RETURN: 'text/html'

Get MIME-Type

$PAGE->mime('txt', false)
RETURN: 'text/plain'

Get file's MIME-Type

$PAGE->mime("example.pdf", false)
RETURN: 'application/pdf'

Click HERE to turn this page into TXT-file

1
$PAGE->mime('txt')
RETURN: FALSE