Location: PHPKode > scripts > xmlSiteMaker > xmlsitemaker/include/Page/PageClasses/Page.php
<?php

load_class( 'Content/Content.php' );
load_class( 'XSLT/XSLT.php' );
load_class( 'Page/PageWriter.php' );

class Page{

  var $page;
  var $xsltName;

  var $elements;

  var $objContent;

  var $xml;

  var $pageWriter;

  var $pageId;

  // constructor
  function Page(){
    $this->elements = array();
    $this->objContent = new Content();
    $this->objXslt = new XSLT();
    $this->pageWriter = new PageWriter();

    $this->xml = '<?xml version="1.0"?'.'>'."\n";
    $this->xml .= '<page-of-site>'."\n";
    $this->xml .= '#add_elements_here#'."\n";
    $this->xml .= '</page-of-site>'."\n";
  }

  // public
  function makePage(){
    $this->makeXml();
    $this->makeXslt();
    $this->makeTransform();
  }

  function generate(){
    $this->makePage();
    $this->writePage();
  }

  function getPage(){
    return $this->page;
  }

  // private
  function makeXml(){
    foreach( $this->elements as $this->element ){
      $this->element->makeContent();
      $this->insertIntoXml();
    }
  }

  function makeXslt(){
    $this->xslt = $this->objContent->getContent( 'xslt:' . $this->xsltName );
  }

  function makeTransform(){
    $this->objXslt->setXML( $this->xml );
    $this->objXslt->setXSLT( $this->xslt );
    $this->objXslt->transform();
    $this->page = $this->objXslt->getResult();
  }

  function insertIntoXml(){
    $name = '#'.$this->element->getName().'#';
    $this->xml = str_replace(
      $name, $this->element->getContent(), $this->xml
    );
  }

  function writePage(){
    echo "write page: {$this->pageId}\n";
    $this->pageWriter->setContent( $this->page );
    $this->pageWriter->setPageId( $this->pageId );
    $this->pageWriter->write();
  }

} // end class

?>
Return current item: xmlSiteMaker