tags to enable formatting
* using CSS.
*
* @author Pascal Van Hecke
* @since 1.7
*/
class HTMLCreator extends FeedCreator
{
protected $contentType = "text/html";
/**
* Contains HTML to be output at the start of the feed's html representation.
*/
public $header;
/**
* Contains HTML to be output at the end of the feed's html representation.
*/
public $footer;
/**
* Contains HTML to be output between entries. A separator is only used in
* case of multiple entries.
*/
public $separator;
/**
* Used to prefix the stylenames to make sure they are unique
* and do not clash with stylenames on the user's page.
*/
public $stylePrefix;
/** @var bool Determines whether the links open in a new window or not. */
public $openInNewWindow = true;
/** @var string image alignments in output */
public $imageAlign = "right";
/**
* In case of very simple output you may want to get rid of the style tags,
* hence this variable. There's no equivalent on item level, but of course you can
* add strings to it while iterating over the items ($this->stylelessOutput .= ...)
* and when it is non-empty, ONLY the styleless output is printed, the rest is ignored
* in the function createFeed().
*/
public $stylelessOutput = "";
/**
* Writes the HTML.
*
* @inheritdoc
*/
public function createFeed()
{
// if there is styleless output, use the content of this variable and ignore the rest
if ($this->stylelessOutput != "") {
return $this->stylelessOutput;
}
//if no stylePrefix is set, generate it yourself depending on the script name
if ($this->stylePrefix == "") {
$this->stylePrefix = str_replace(".", "_", $this->_generateFilename())."_";
}
//set an openInNewWindow_token_to be inserted or not
if ($this->openInNewWindow) {
$targetInsert = " class='target_blank'";
} else {
$targetInsert = '';
}
// use this array to put the lines in and implode later with "document.write" javascript
$feedArray = array();
if ($this->image != null) {
$imageStr = "".
"image->width) {
$imageStr .= " width='".$this->image->width."' ";
}
if ($this->image->height) {
$imageStr .= " height='".$this->image->height."' ";
}
$imageStr .= "/>";
$feedArray[] = $imageStr;
}
if ($this->title) {
$feedArray[] = "