You are here

public function FrxTemplate::__construct in Forena Reports 7.3

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

File

templates/FrxTemplate.inc, line 18
FrxTemplate Base Class for all tmeplates. By default simply renders a document with all the possible tokens in it. @author davidmetzler

Class

FrxTemplate
@file FrxTemplate Base Class for all tmeplates. By default simply renders a document with all the possible tokens in it. @author davidmetzler

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 template document', '<pre>' . $e
      ->getMessage() . $e
      ->getTraceAsString() . '</pre>');
  }
  $this->body = $dom
    ->getElementsByTagName('body')
    ->item(0);
}