Jelix 1.8.13

jResponseHtml extends jResponseBasicHtml
in package

HTML5 response.

Tags
subpackage

core_response

Table of Contents

$body  : jTpl
The template engine used to generate the body content.
$bodyErrorTpl  : string
Selector of the template used when there are some errors, instead of $bodyTpl.
$bodyTagAttributes  : array<string|int, mixed>
body attributes These attributes are written on the body tag.
$bodyTpl  : string
selector of the main template file This template should contains the body content, and is used by the $body template engine.
$favicon  : string
favicon url linked to the document.
$forcedHttpVersion  : bool
$htmlFile  : string
full path of php file to output. it should content php instruction to display these variables: - $HEADTOP: content added just after the opening <head> tag - $HEADBOTTOM: content before the closing </head> tag - $BODYTOP: content just after the <body> tag, at the top of the page - $BODYBOTTOM: content just before the </body> tag, at the bottom of the page - $BASEPATH: base path of the application, for links of your style sheets etc.
$htmlTagAttributes  : array<string|int, mixed>
html attributes These attributes are written on the html tag.
$httpVersion  : string
$IECompatibilityMode  : string
$metaViewport  : string
$title  : string
Title of the document.
$xhtmlContentType  : bool
says if xhtml content type should be send or not.
$_bodyBottom  : mixed
$_bodyTop  : mixed
$_charset  : string
the charset of the document.
$_CSSIELink  : array<string|int, array<string|int, mixed>>
list of css stylesheet for IE.
$_CSSLink  : array<string|int, array<string|int, mixed>>
list of css stylesheet.
$_endTag  : string
the end tag to finish tags. it is different if we are in XHTML mode or not.
$_headBottom  : mixed
bottom content for head.
$_headTop  : mixed
top content for head.
$_httpHeaders  : array<string|int, mixed>
$_httpHeadersSent  : bool
$_httpStatusCode  : string
$_httpStatusMsg  : string
$_isXhtml  : mixed
says if the document is in xhtml or html.
$_JSCode  : array<string|int, string>
inline js code to insert after js links.
$_JSCodeBefore  : array<string|int, string>
inline js code to insert before js links.
$_JSIELink  : array<string|int, array<string|int, mixed>>
list of js script for IE.
$_JSLink  : array<string|int, array<string|int, mixed>>
list of js script.
$_lang  : string
the lang of the document (xx from locale xx_YY).
$_Link  : array<string|int, mixed>
list of information to generate link tags.
$_locale  : string
the locale of the document (xx_YY).
$_Meta  : array<string|int, array<string|int, mixed>>
$_MetaAuthor  : string
content of the meta author tag.
$_MetaDescription  : array<string|int, string>
list of descriptions to add into a meta description tag.
$_MetaGenerator  : string
content of the meta generator tag.
$_MetaKeywords  : array<string|int, string>
list of keywords to add into a meta keyword tag.
$_MetaOldContentType  : bool
$_outputOnlyHeaders  : bool
$_Styles  : array<string|int, string>
list of CSS code.
$_type  : string
jresponse id.
$plugins  : array<string|int, jIHTMLResponsePlugin>
list of plugins.
$webAssetsSelection  : WebAssetsSelection
__construct()  : mixed
constructor; setup the charset, the lang, the template engine.
addAssets()  : mixed
adds a web assets group.
addContent()  : mixed
add content to the body you can add additionnal content, before or after the content of body.
addCSSLink()  : mixed
add a link to a css stylesheet in the document head.
addCSSLinkModule()  : mixed
add a link to a css stylesheet stored into modules.
addCSSThemeLinkModule()  : mixed
add a link to a csstheme stylesheet stored into modules.
addHeadContent()  : mixed
add additional content into the document head.
addHttpHeader()  : mixed
add an http header to the response.
addJSCode()  : mixed
add inline javascript code (inside a <script> tag).
addJSLink()  : mixed
add a link to a javascript script in the document head.
addJSLinkModule()  : mixed
add a link to a javascript script stored into modules.
addLink()  : mixed
add a generic link to the head.
addMeta()  : mixed
add a meta element.
addMetaAuthor()  : mixed
add author(s) in a author meta tag.
addMetaDescription()  : mixed
add a description in a description meta tag.
addMetaGenerator()  : mixed
add generator a generator meta tag.
addMetaKeywords()  : mixed
add some keywords in a keywords meta tag.
addStyle()  : mixed
add inline css style into the document (inside a <style> tag).
appendRevisionToQueryParameters()  : mixed
Add the revision parameter to the given list of query parameters.
appendRevisionToUrl()  : string
Append the revision parameter to the given url string.
cleanCacheHeaders()  : mixed
Clean the differents caches headers.
clearHtmlHeader()  : mixed
used to erase some head properties.
clearHttpHeaders()  : mixed
delete all http headers.
endTag()  : string
return the end of a html tag : "/>" or ">", depending if it will generate xhtml or html.
getCSSIELinks()  : array<string|int, mixed>
returns all CSS links for IE.
getCSSLinks()  : array<string|int, mixed>
returns all CSS links.
getFormatType()  : string
return the format type name (eg the family type name).
getHttpHeaders()  : mixed
getJSIELinks()  : array<string|int, mixed>
returns all JS links for IE.
getJSLinks()  : array<string|int, mixed>
returns all JS links.
getPlugin()  : null|jIHTMLResponsePlugin
return the corresponding plugin.
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.
isXhtml()  : bool
says if the response will be xhtml or html.
output()  : bool
output the html content.
outputErrors()  : mixed
Send a response with a generic error message.
setBodyAttributes()  : mixed
set attributes on the body tag.
setCSSIELinks()  : mixed
set all CSS links for IE.
setCSSLinks()  : mixed
set all CSS links.
setExpires()  : mixed
Set an expires header to the page/ressource.
setHtmlAttributes()  : mixed
set attributes on the html tag.
setHttpStatus()  : mixed
set the http status code for the http header.
setJSIELinks()  : mixed
set all JS links for IE.
setJSLinks()  : mixed
set all JS links.
setLifetime()  : mixed
Set a life time for the page/ressource.
setTitle()  : mixed
set the title of the page.
setXhtmlOutput()  : mixed
change the type of html for the output.
_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 html response overload it if you want to add processes (stylesheet, head settings, additionnal content etc..) after any actions.
outputCssLinkTag()  : mixed
outputDoctype()  : mixed
generate the doctype. You can override it if you want to have your own doctype, like XHTML+MATHML.
outputHtmlHeader()  : mixed
generate the content of the <head> content.
outputIconLinkTag()  : mixed
outputJsScriptTag()  : mixed
outputMetaTag()  : mixed
sendHttpHeaders()  : mixed
send http headers.
setContentType()  : mixed
set the content-type in the http headers.

Properties

$bodyErrorTpl

Selector of the template used when there are some errors, instead of $bodyTpl.

public string $bodyErrorTpl = ''
Tags

$bodyTagAttributes

body attributes These attributes are written on the body tag.

public array<string|int, mixed> $bodyTagAttributes = array()
Tags

$bodyTpl

selector of the main template file This template should contains the body content, and is used by the $body template engine.

public string $bodyTpl = ''
Tags

$favicon

favicon url linked to the document.

public string $favicon = ''
Tags
since
1.0b2

$forcedHttpVersion

public bool $forcedHttpVersion = \false

indicate to use the version from $httpVersion

Tags

$htmlFile

full path of php file to output. it should content php instruction to display these variables: - $HEADTOP: content added just after the opening <head> tag - $HEADBOTTOM: content before the closing </head> tag - $BODYTOP: content just after the <body> tag, at the top of the page - $BODYBOTTOM: content just before the </body> tag, at the bottom of the page - $BASEPATH: base path of the application, for links of your style sheets etc.

public string $htmlFile = ''

.

Tags

$htmlTagAttributes

html attributes These attributes are written on the html tag.

public array<string|int, mixed> $htmlTagAttributes = array()
Tags

$httpVersion

public string $httpVersion = '1.1'

the HTTP version to use for the response

Tags

$IECompatibilityMode

public string $IECompatibilityMode = ''

indicate the value for the X-UA-Compatible meta element, which indicate the compatiblity mode of IE. Exemple: "IE=edge" In future version, default will be "IE=edge".

Tags
since
1.6.17

$metaViewport

public string $metaViewport = ''

the content of the viewport meta element

Tags
since
1.6.17

$xhtmlContentType

says if xhtml content type should be send or not.

public bool $xhtmlContentType = \false

it true, a verification of HTTP_ACCEPT is done.

Tags

list of css stylesheet for IE.

protected array<string|int, array<string|int, mixed>> $_CSSIELink = array()

key = url, value=link attributes + optional parameter _iecondition

Tags
deprecated

since 1.7.0

list of css stylesheet.

protected array<string|int, array<string|int, mixed>> $_CSSLink = array()

key = url, value=link attributes

Tags

$_endTag

the end tag to finish tags. it is different if we are in XHTML mode or not.

protected string $_endTag = "/>\n"
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

$_JSCode

inline js code to insert after js links.

protected array<string|int, string> $_JSCode = array()

list of js source code

Tags

$_JSCodeBefore

inline js code to insert before js links.

protected array<string|int, string> $_JSCodeBefore = array()

list of js source code

Tags

list of js script for IE.

protected array<string|int, array<string|int, mixed>> $_JSIELink = array()

key = url, value=link attributes + optional parameter _iecondition

Tags
deprecated

since 1.7.0

list of js script.

protected array<string|int, array<string|int, mixed>> $_JSLink = array()

key = url, value=link attributes

Tags

list of information to generate link tags.

protected array<string|int, mixed> $_Link = array()

keys are the href value, valu is an array ('rel','type','title')

Tags

$_Meta

protected array<string|int, array<string|int, mixed>> $_Meta = array()

list of arrays containing attributes for each meta elements

Tags
since
1.6.17

$_MetaAuthor

content of the meta author tag.

protected string $_MetaAuthor = ''
Tags

$_MetaDescription

list of descriptions to add into a meta description tag.

protected array<string|int, string> $_MetaDescription = array()
Tags

$_MetaGenerator

content of the meta generator tag.

protected string $_MetaGenerator = ''
Tags

$_MetaKeywords

list of keywords to add into a meta keyword tag.

protected array<string|int, string> $_MetaKeywords = array()
Tags

$_MetaOldContentType

protected bool $_MetaOldContentType = \true

false if it should be output or true for the default old behavior : <meta content="text/html; charset=""../>

Tags
since
1.6.17

$_outputOnlyHeaders

protected bool $_outputOnlyHeaders = \false

Should we output only the headers or the entire response

Tags

$_Styles

list of CSS code.

protected array<string|int, string> $_Styles = array()
Tags

Methods

__construct()

constructor; setup the charset, the lang, the template engine.

public __construct() : mixed
Tags
Return values
mixed

addAssets()

adds a web assets group.

public addAssets(string $assetGroup) : mixed
Parameters
$assetGroup : string
Tags
Return values
mixed

addContent()

add content to the body you can add additionnal content, before or after the content of body.

public addContent(string $content[, bool $before = false ]) : mixed
Parameters
$content : string

additionnal html content

$before : bool = false

true if you want to add it before the content, else false for after

Tags
Return values
mixed

add a link to a css stylesheet in the document head.

public addCSSLink(string $src[, array<string|int, mixed> $params = array() ][, mixed $forIE = false ]) : mixed

$forIe parameter exists since 1.0b2

Parameters
$src : string

the link

$params : array<string|int, mixed> = array()

additionnals attributes for the link tag

$forIE : mixed = false

if true, the style sheet will be only for IE browser. string values possible (ex:'lt IE 7')

Tags
Return values
mixed

addCSSLinkModule()

add a link to a css stylesheet stored into modules.

public addCSSLinkModule(string $module, mixed $src[, mixed $params = array() ][, bool $forIE = false ]) : mixed
Parameters
$module : string

the module where file is stored

$src : mixed

the relative path inside the {module}/www/ directory

$params : mixed = array()
$forIE : bool = false

if true, the script sheet will be only for IE browser. string values possible (ex:'lt IE 7')

Tags
params

array $params additionnal parameters for the generated tag (a media attribute for stylesheet for example)

Return values
mixed

addCSSThemeLinkModule()

add a link to a csstheme stylesheet stored into modules.

public addCSSThemeLinkModule(string $module, mixed $src[, mixed $params = array() ][, bool $forIE = false ]) : mixed
Parameters
$module : string

the module where file is stored

$src : mixed

the relative path inside the {module}/www/themes/{currenttheme}/ directory

$params : mixed = array()
$forIE : bool = false

if true, the script sheet will be only for IE browser. string values possible (ex:'lt IE 7')

Tags
params

array $params additionnal parameters for the generated tag (a media attribute for stylesheet for example)

Return values
mixed

addHeadContent()

add additional content into the document head.

public final addHeadContent(string $content[, bool $toTop = false ]) : mixed
Parameters
$content : string
$toTop : bool = false

true if you want to add it at the top of the head content, else false for the bottom

Tags
since
1.0b1
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

addJSCode()

add inline javascript code (inside a <script> tag).

public addJSCode(string $code[, bool $before = false ]) : mixed
Parameters
$code : string

javascript source code

$before : bool = false

will insert the code before js links if true

Tags
Return values
mixed

add a link to a javascript script in the document head.

public addJSLink(string $src[, array<string|int, mixed> $params = array() ][, bool $forIE = false ]) : mixed

$forIe parameter exists since 1.0b2

Parameters
$src : string

the link

$params : array<string|int, mixed> = array()

additionals attributes for the script tag

$forIE : bool = false

if true, the script sheet will be only for IE browser. string values possible (ex:'lt IE 7'). Deprecated parameter.

Tags
Return values
mixed

addJSLinkModule()

add a link to a javascript script stored into modules.

public addJSLinkModule(string $module, mixed $src[, array<string|int, mixed> $params = array() ][, bool $forIE = false ]) : mixed
Parameters
$module : string

the module where file is stored

$src : mixed

the relative path inside the {module}/www/ directory

$params : array<string|int, mixed> = array()

additionnal parameters for the generated tag (a media attribute for stylesheet for example)

$forIE : bool = false

if true, the script sheet will be only for IE browser. string values possible (ex:'lt IE 7'). Deprecated parameter.

Tags
Return values
mixed

add a generic link to the head.

public addLink(string $href, string $rel[, string $type = '' ][, string $title = '' ]) : mixed
Parameters
$href : string

url of the link

$rel : string

relation name

$type : string = ''

mime type of the ressource

$title : string = ''
Tags
Return values
mixed

addMeta()

add a meta element.

public addMeta(mixed $params) : mixed
Parameters
$params : mixed
Tags
Return values
mixed

addMetaAuthor()

add author(s) in a author meta tag.

public addMetaAuthor(string $content) : mixed
Parameters
$content : string

author(s)

Tags
author

Olivier Demah

since
1.2
Return values
mixed

addMetaDescription()

add a description in a description meta tag.

public addMetaDescription(string $content) : mixed
Parameters
$content : string

a description

Tags
author

Yann

since
1.0b1
Return values
mixed

addMetaGenerator()

add generator a generator meta tag.

public addMetaGenerator(string $content) : mixed
Parameters
$content : string

generator

Tags
author

Olivier Demah

since
1.2
Return values
mixed

addMetaKeywords()

add some keywords in a keywords meta tag.

public addMetaKeywords(string $content) : mixed
Parameters
$content : string

keywords

Tags
author

Yann

since
1.0b1
Return values
mixed

addStyle()

add inline css style into the document (inside a <style> tag).

public addStyle(string $selector[, string $def = null ]) : mixed
Parameters
$selector : string

css selector

$def : string = null

css properties for the given selector

Tags
Return values
mixed

appendRevisionToQueryParameters()

Add the revision parameter to the given list of query parameters.

public appendRevisionToQueryParameters(array<string|int, mixed> &$parameters) : mixed
Parameters
$parameters : array<string|int, mixed>

list of query parameters

Tags
Return values
mixed

appendRevisionToUrl()

Append the revision parameter to the given url string.

public appendRevisionToUrl(string $url) : string
Parameters
$url : string
Tags
Return values
string

cleanCacheHeaders()

Clean the differents caches headers.

public cleanCacheHeaders() : mixed
Tags
Return values
mixed

clearHtmlHeader()

used to erase some head properties.

public clearHtmlHeader([array<string|int, mixed> $what = null ]) : mixed
Parameters
$what : array<string|int, mixed> = null

list of one or many of this strings : 'CSSLink', 'CSSIELink', 'Styles', 'JSLink', 'JSIELink', 'JSCode', 'Others','MetaKeywords','MetaDescription'. If null, it cleans all values.

Tags
Return values
mixed

clearHttpHeaders()

delete all http headers.

public clearHttpHeaders() : mixed
Tags
Return values
mixed

endTag()

return the end of a html tag : "/>" or ">", depending if it will generate xhtml or html.

public endTag() : string
Tags
Return values
string

returns all CSS links for IE.

public getCSSIELinks() : array<string|int, mixed>
Tags
deprecated

since 1.7.0

Return values
array<string|int, mixed>

key = url, value=link attributes + optional parameter _iecondition

returns all CSS links.

public getCSSLinks() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>

key = url, value=link attributes

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

returns all JS links for IE.

public getJSIELinks() : array<string|int, mixed>
Tags
deprecated

since 1.7.0

Return values
array<string|int, mixed>

key = url, value=link attributes + optional parameter _iecondition

returns all JS links.

public getJSLinks() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>

key = url, value=link attributes

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

isXhtml()

says if the response will be xhtml or html.

public final isXhtml() : bool
Tags
Return values
bool

true if it is xhtml

output()

output the html content.

public output() : bool
Tags
Return values
bool

true if the generated content is ok

outputErrors()

Send a response with a generic error message.

public outputErrors() : mixed
Tags
Return values
mixed

setBodyAttributes()

set attributes on the body tag.

public setBodyAttributes(array<string|int, mixed> $attrArray) : mixed
Parameters
$attrArray : array<string|int, mixed>

an associative array of attributes and their values

Tags
Return values
mixed

set all CSS links for IE.

public setCSSIELinks(array<string|int, mixed> $list) : mixed
Parameters
$list : array<string|int, mixed>

key = url, value=link attributes

Tags
deprecated

since 1.7.0

Return values
mixed

set all CSS links.

public setCSSLinks(array<string|int, mixed> $list) : mixed
Parameters
$list : array<string|int, mixed>

key = url, value=link attributes

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
see
jResponse::_normalizeDate()
Return values
mixed

setHtmlAttributes()

set attributes on the html tag.

public setHtmlAttributes(array<string|int, mixed> $attrArray) : mixed
Parameters
$attrArray : array<string|int, mixed>

an associative array of attributes and their values

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

set all JS links for IE.

public setJSIELinks(array<string|int, mixed> $list) : mixed
Parameters
$list : array<string|int, mixed>

key = url, value=link attributes

Tags
deprecated

since 1.7.0

Return values
mixed

set all JS links.

public setJSLinks(array<string|int, mixed> $list) : mixed
Parameters
$list : array<string|int, mixed>

key = url, value=link attributes

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

setTitle()

set the title of the page.

public setTitle(string $title) : mixed
Parameters
$title : string
Tags
Return values
mixed

setXhtmlOutput()

change the type of html for the output.

public setXhtmlOutput([bool $xhtml = true ]) : mixed
Parameters
$xhtml : bool = true

true if you want xhtml, false if you want html

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 html response overload it if you want to add processes (stylesheet, head settings, additionnal content etc..) after any actions.

protected doAfterActions() : mixed
Tags
since
1.1
Return values
mixed

outputCssLinkTag()

protected outputCssLinkTag(mixed $fileUrl, mixed $cssParams) : mixed
Parameters
$fileUrl : mixed
$cssParams : mixed
Tags
Return values
mixed

outputDoctype()

generate the doctype. You can override it if you want to have your own doctype, like XHTML+MATHML.

protected outputDoctype() : mixed
Tags
since
1.1
Return values
mixed

outputHtmlHeader()

generate the content of the <head> content.

protected outputHtmlHeader() : mixed
Tags
Return values
mixed

outputIconLinkTag()

protected outputIconLinkTag(mixed $fileUrl, mixed $iconParams) : mixed
Parameters
$fileUrl : mixed
$iconParams : mixed
Tags
Return values
mixed

outputJsScriptTag()

protected outputJsScriptTag(mixed $fileUrl, mixed $scriptParams) : mixed
Parameters
$fileUrl : mixed
$scriptParams : mixed
Tags
Return values
mixed

outputMetaTag()

protected outputMetaTag(array<string|int, string> $params) : mixed
Parameters
$params : array<string|int, string>

list of attributes to add to a meta element

Tags
since
1.6.17
Return values
mixed

sendHttpHeaders()

send http headers.

protected sendHttpHeaders() : mixed
Tags
Return values
mixed

setContentType()

set the content-type in the http headers.

protected setContentType() : mixed
Tags
Return values
mixed

Search results