comparison class.template.php @ 2:ad12469f4db4

Initialisation de xmlDocument, puis chargement. Avant, on faisait un xmlDocument->validateOnParse sans avoir initialiser (donc, sur un NULL, c'est etrange que PHP n'est pas bronche), puis on utilisait une methode statique sur DOMDocument... Passage en privee des deux variables.
author Franck Deroche <webmaster@defr.net>
date Fri, 16 Mar 2007 16:01:10 +0100
parents 0f40a8a39c68
children a76a46cbb401
comparison
equal deleted inserted replaced
1:0f40a8a39c68 2:ad12469f4db4
1 <?php 1 <?php
2 class Template { 2 class Template {
3 var $xmlDocument; 3 private $xmlDocument;
4 var $xmlXPath; 4 private $xmlXPath;
5 5
6 const NS = 'http://defr.net/2007/template'; 6 const NS = 'http://defr.net/2007/template';
7 7
8 function __construct($fileName) { 8 function __construct($fileName) {
9 $this->xmlDocument = new DOMDocument();
9 $this->xmlDocument->validateOnParse = true; 10 $this->xmlDocument->validateOnParse = true;
10 $this->xmlDocument = DOMDocument::loadXML(file_get_contents($fileName)); 11 $this->xmlDocument->loadXML(file_get_contents($fileName));
11 $this->xmlXPath = new DOMXPath($this->xmlDocument); 12 $this->xmlXPath = new DOMXPath($this->xmlDocument);
12 } 13 }
13 14
14 function apply($selector, $obj) { 15 function apply($selector, $obj) {
15 $rootSelector = $this->parseSelector($selector); 16 $rootSelector = $this->parseSelector($selector);