jResponseHtmlFragment
extends jResponse
in package
Send Html part.
Tags
Table of Contents
- $forcedHttpVersion : bool
- $httpVersion : string
- $tpl : jTpl
- the jtpl object created automatically.
- $tplname : string
- template selector set the template name in this property.
- $_contentBottom : mixed
- $_contentTop : mixed
- $_httpHeaders : array<string|int, mixed>
- $_httpHeadersSent : bool
- $_httpStatusCode : string
- $_httpStatusMsg : string
- $_outputOnlyHeaders : bool
- $_type : string
- jresponse id.
- __construct() : mixed
- constructor; setup the template engine.
- addContent() : mixed
- add content to the response you can add additionnal content, before or after the content generated by the main template.
- addHttpHeader() : mixed
- add an http header to the response.
- cleanCacheHeaders() : mixed
- Clean the differents caches headers.
- clearHttpHeaders() : mixed
- delete all http headers.
- getFormatType() : string
- return the format type name (eg the family type name).
- getHttpHeaders() : mixed
- getType() : string
- return the response type name.
- isValidCache() : bool
- Use the HTTP headers Last-Modified to see if the resource in client cache is fresh.
- output() : bool
- send the Html part.
- outputErrors() : mixed
- output errors.
- setExpires() : mixed
- Set an expires header to the page/ressource.
- setHttpStatus() : mixed
- set the http status code for the http header.
- setLifetime() : mixed
- Set a life time for the page/ressource.
- _checkRequestType() : mixed
- check if the request is of type GET or HEAD.
- _normalizeDate() : string
- Normalize a date into GMT format.
- doAfterActions() : mixed
- The method you can overload in your inherited htmlfragment response after all actions.
- sendHttpHeaders() : mixed
- send http headers.
Properties
$forcedHttpVersion
public
bool
$forcedHttpVersion
= \false
indicate to use the version from $httpVersion
Tags
$httpVersion
public
string
$httpVersion
= '1.1'
the HTTP version to use for the response
Tags
$tpl
the jtpl object created automatically.
public
jTpl
$tpl
Tags
$tplname
template selector set the template name in this property.
public
string
$tplname
= ''
Tags
$_contentBottom
protected
mixed
$_contentBottom
= array()
Tags
$_contentTop
protected
mixed
$_contentTop
= array()
Tags
$_httpHeaders
protected
array<string|int, mixed>
$_httpHeaders
= array()
list of http headers that will be send to the client
Tags
$_httpHeadersSent
protected
bool
$_httpHeadersSent
= \false
indicates if http headers have already been sent to the client
Tags
$_httpStatusCode
protected
string
$_httpStatusCode
= '200'
the http status code to send
Tags
$_httpStatusMsg
protected
string
$_httpStatusMsg
= 'OK'
the http status message to send
Tags
$_outputOnlyHeaders
protected
bool
$_outputOnlyHeaders
= \false
Should we output only the headers or the entire response
Tags
$_type
jresponse id.
protected
string
$_type
= 'htmlfragment'
Tags
Methods
__construct()
constructor; setup the template engine.
public
__construct() : mixed
Tags
Return values
mixed —addContent()
add content to the response you can add additionnal content, before or after the content generated by the main template.
public
addContent(string $content[, bool $beforeTpl = false ]) : mixed
Parameters
- $content : string
-
additionnal html content
- $beforeTpl : bool = false
-
true if you want to add it before the template content, else false for after
Tags
Return values
mixed —addHttpHeader()
add an http header to the response.
public
addHttpHeader(string $htype, string $hcontent[, int $overwrite = true ]) : mixed
will be send during the output of the response.
Parameters
- $htype : string
-
the header type ("Content-Type", "Date-modified"...)
- $hcontent : string
-
value of the header type
- $overwrite : int = true
-
false or 0 if the value should be set only if it doesn't still exist -1 to add the header with the existing values true or 1 to replace the existing header
Tags
Return values
mixed —cleanCacheHeaders()
Clean the differents caches headers.
public
cleanCacheHeaders() : mixed
Tags
Return values
mixed —clearHttpHeaders()
delete all http headers.
public
clearHttpHeaders() : mixed
Tags
Return values
mixed —getFormatType()
return the format type name (eg the family type name).
public
getFormatType() : string
Tags
Return values
string —the name
getHttpHeaders()
public
getHttpHeaders() : mixed
Tags
Return values
mixed —getType()
return the response type name.
public
final getType() : string
Tags
Return values
string —the name
isValidCache()
Use the HTTP headers Last-Modified to see if the resource in client cache is fresh.
public
isValidCache([mixed $dateLastModified = null ][, null|mixed $etag = null ][, bool $cleanCacheHeader = true ]) : bool
Parameters
- $dateLastModified : mixed = null
-
Can be a jDateTime object, a DateTime object or a string understandable by strtotime
- $etag : null|mixed = null
- $cleanCacheHeader : bool = true
-
True for clean/delete other cache headers. Default : true.
Tags
Return values
bool —True if the client resource version is fresh, false otherwise
output()
send the Html part.
public
output() : bool
Tags
Return values
bool —true if it's ok
outputErrors()
output errors.
public
outputErrors() : mixed
Tags
Return values
mixed —setExpires()
Set an expires header to the page/ressource.
public
setExpires(mixed $date[, mixed $cleanCacheHeader = true ]) : mixed
Parameters
- $date : mixed
- $cleanCacheHeader : mixed = true
Tags
Return values
mixed —setHttpStatus()
set the http status code for the http header.
public
setHttpStatus(string $code, string $msg) : mixed
Parameters
- $code : string
-
the status code (200, 404...)
- $msg : string
-
the message following the status code ("OK", "Not Found"..)
Tags
Return values
mixed —setLifetime()
Set a life time for the page/ressource.
public
setLifetime(int $time[, bool $sharedCache = false ][, mixed $cleanCacheHeader = true ]) : mixed
Parameters
- $time : int
-
Time during which the page will be cached. Express in seconds.
- $sharedCache : bool = false
-
True if the lifetime concern a public/shared cache. Default : false.
- $cleanCacheHeader : mixed = true
Tags
Return values
mixed —_checkRequestType()
check if the request is of type GET or HEAD.
protected
_checkRequestType() : mixed
Tags
Return values
mixed —_normalizeDate()
Normalize a date into GMT format.
protected
_normalizeDate(mixed $date) : string
Parameters
- $date : mixed
-
Can be a jDateTime object, a DateTime object or a string understandable by strtotime
Tags
Return values
string —a date in GMT format
doAfterActions()
The method you can overload in your inherited htmlfragment response after all actions.
protected
doAfterActions() : mixed
Tags
Return values
mixed —sendHttpHeaders()
send http headers.
protected
sendHttpHeaders() : mixed