1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| // chargement des vues
public function ProcessView()
{
// nombre de vues
$items = $this->HTMLDoc->getElementsByTagName("view");
$itemcount = $items->length;
for($i = 0; $i < $itemcount; $i++)
{
$item = $items->item($i);
$parent = $item->parentNode;
// second document html
$name = $item->getAttribute("name");
$filename = $name . '.view';
$filepath = 'nodes/' . get_class($this) . '/views/' . $filename;
if(file_exists($filepath))
{
$view = new DOMDocument;
if($view->loadHTMLFile($filepath))
{
$bodies = $view->getElementsByTagName("body");
$boydcount = $bodies->length;
for($j = 0; $j < $boydcount; $j++)
{
$body = $bodies->item($j);
// acun enfant trouvé !
if($body->hasChildNodes)
{
foreach($body->childNodes as $child)
{
$clone = $view->importNode($child, true);
$parent->appendChild($clone);
}
}
}
}
}
else echo "file not found @ " . $filepath . "<br>";
}
} |
Partager