Page HTMLPage

public class HTMLPage extends Page

class.htmlpage.php #10

HTMLPage extends the Page class to provide an object representation of a Symphony backend page.

Properties

XMLElement $Body

An XMLElement object for the <body>

XMLElement $Form

An XMLElement object for the <form>. Most Symphony backend pages are contained within a main form

XMLElement $Head

An XMLElement object for the <head>

XMLElement $Html

An XMLElement object for the <html> element. This is the parent DOM element for all other elements on the output page.

Methods

string __buildQueryString(array $exclude, integer $filters)

This function builds a HTTP query string from $_GET parameters with the option to remove parameters with an $exclude array. Since Symphony 2.6.0 it is also possible to override the default filters on the resulting string.

Parameters
  • $exclude arrayA simple array with the keys that should be omitted in the resulting query string.

  • $filters integerThe resulting query string is parsed through filter_var. By default the options are FILTERFLAGSTRIPLOW, FILTERFLAGSTRIPHIGH and FILTERSANITIZESTRING, but these can be overridden as desired.

See Also
void __construct()

Constructor for the HTMLPage. Intialises the class variables with empty instances of XMLElement

integer addElementToHead(XMLElement $object, integer $position, boolean $allowDuplicate)

Adds an XMLElement to the $this->_head array at a desired position. If no position is given, the object will be added to the end of the $this->_head array. If that position is already taken, it will add the object at the next available position.

Parameters
  • $position integerDefaults to null which will put the $object at the end of the $this->_head.

  • $allowDuplicate booleanIf set to false, make this function check if there is already an XMLElement that as the same name in the head. Defaults to true. @since Symphony 2.3.2

Returns

Returns the position that the $object has been set in the $this->_head

See Also
integer addScriptToHead(string $path, integer $position, boolean $duplicate)

Convenience function to add a <script> element to the $this->_head. By default the function will allow duplicates to be added to the $this->_head. A duplicate is determined by if the $path is unique.

Parameters
  • $path stringThe path to the script file

  • $position integerThe desired position that the resulting XMLElement will be placed in the $this->_head. Defaults to null which will append to the end.

  • $duplicate booleanWhen set to false the function will only add the script if it doesn't already exist. Defaults to true which allows duplicates.

Returns

Returns the position that the script has been set in the $this->_head

integer addStylesheetToHead(string $path, string $type, integer $position, boolean $duplicate)

Convenience function to add a stylesheet to the $this->_head in a <link> element. By default the function will allow duplicates to be added to the $this->_head. A duplicate is determined by if the $path is unique.

Parameters
  • $path stringThe path to the stylesheet file

  • $type stringThe media attribute for this stylesheet, defaults to 'screen'

  • $position integerThe desired position that the resulting XMLElement will be placed in the $this->_head. Defaults to null which will append to the end.

  • $duplicate booleanWhen set to false the function will only add the script if it doesn't already exist. Defaults to true which allows duplicates.

Returns

Returns the position that the stylesheet has been set in the $this->_head

boolean checkElementsInHead(string $path, string $attribute)

Determines if two elements are duplicates based on an attribute and value

Parameters
  • $path stringThe value of the attribute

  • $attribute stringThe attribute to check

string generate(null $page)

The generate function calls the __build() function before appending all the current page's headers and then finally calling the $Html's generate function which generates a HTML DOM from all the XMLElement children.

See Also
void removeFromHead(string $elementName)

Given an elementName, this function will remove the corresponding XMLElement from the $this->_head

void removeFromHeadByPosition(integer $position)

Removes an item from $this->_head by it's index.

int setTitle(string $title)

Setter function for the <title> of a backend page. Uses the addElementToHead() function to place into the $this->_head array. Makes sure that only one title can be set.

Returns

Returns the position that the title has been set in the $_head

See Also

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details