Whenever an application returns a form, a table of data or
anything else that has to be placed on a Web page, you get back an
associative array with two keys: headers
and
body
.
A dummy example could be something like this:
array(2) { ["body"]=> string(74) "<p class="great">a lot of content that goes into the body of your page</p>" ["headers"]=> string(0) "<link rel="stylesheet" href="/m2/great/stylesheet.css" type="text/css" />" }
The value of headers
can be put in the
<head>...</head>
section of your page, and
the value of body
goes in the
<body>...</body>
part. This way Moski2.net
can include javascript and css used to present the content in a proper
manner.
If you are using a templating system and need to build the
header part of your page programmatically instead of just including
raw HTML, you can typically send along a rawHeaders =>
TRUE
parameter to the application and now you will get back
something like this instead:
array(2) { ["body"]=> string(74) "<p class="great">a lot of content that goes into the body of your page</p>" ["headers"]=> array(1) { ["cssFiles"]=> array(1) { [0]=> string(24) "/m2/great/stylesheet.css" } } }
The documentation for each application will tell you if, when
and how it supports the use of raw headers, and if it does, you can
expect keys in the headers
slot to be the
following:
Table 28. Array keys when asking an app for raw headers
Key | Description |
---|---|
css | Raw CSS |
cssFiles | Array of URLs for CSS files |
js | Raw JavaScript |
jsFiles | Array of URLs for JavaScript files |