You are here

public function FrxTemplate::__construct in Forena Reports 7.2

Same name and namespace in other branches
  1. 6.2 templates/FrxTemplate.inc \FrxTemplate::__construct()
  2. 7.3 templates/FrxTemplate.inc \FrxTemplate::__construct()

File

templates/FrxTemplate.inc, line 17

Class

FrxTemplate

Code

public function __construct($xml_string = '') {
  $this->dom = new DOMDocument('1.0', 'UTF-8');
  $dom = $this->dom;

  // Load a new one or build the empty XML Document
  $xml_string = $this->doc_prefix . '<html xmlns:frx="urn:FrxReports"><head/><body/></html>';
  libxml_use_internal_errors();
  try {
    $dom
      ->loadXML($xml_string);
  } catch (Exception $e) {
    forena_error('Invalid or malformed tmeplate document', '<pre>' . $e
      ->getMessage() . $e
      ->getTraceAsString() . '</pre>');
  }
  $this->body = $dom
    ->getElementsByTagName('body')
    ->item(0);
}