Sends the HTTP headers to the browser that declare the content-type and document encoding taken from the charset configuration directive. The $contentType parameter may be one of these constants:
If no type matches to your preferences, specify it manually. If the debug console is enabled, OPT changes the content-type to text/html in order to be able to add the console code into the output. In this case, the debug console specifies the following type used:
application/xhtml+xml (text/html used for debug purposes)
The optional second parameter decides, whether the proxy servers should cache the content we send (OPT_HTTP_CACHE, default setting) or not (OPT_NO_HTTP_CACHE). We recommend to call the method just after the parser initialization.
Example 3.6. fetch()
<?php
try
{
$tpl = new optClass;
$tpl -> loadConfig('config.php');
$tpl -> httpHeaders(OPT_HTML);
// your code here
}
catch(optException $exception)
{
optErrorHandler($exception);
}
?>Custom content type:
$tpl -> httpHeaders('application/xml+vrml');Note: this method is not available, if the Header support was removed from the source with OPT Configurator.