Login   Register  
PHP Classes
elePHPant
Icontem

File: class/xmlmenu.cls.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Johan Barbier  >  XML to HTML menu  >  class/xmlmenu.cls.php  
File: class/xmlmenu.cls.php
Role: Class source
Content type: text/plain
Description: xmlmenu factory class
Class: XML to HTML menu
Generate menus in XML and HTML
 

Contents

Class file image Download
<?php
class xmlmenu {

    private function 
__construct () {
        
// FORBIDDEN TO CALL THE CONSTRUCTOR ;-)
    
}

    public static function 
getInstance ($sVersion null$sEncodingnull) {
        if (!
class_exists ('DOMDocument')) {
            
$sInstance 'xmlmenuhasnone';
        } elseif (!
class_exists ('XSLTProcessor')) {
            
$sInstance 'xmlmenuhasdom';
        } else {
            
$sInstance 'xmlmenuhasboth';
        }
        
//$sInstance = 'xmlmenuhasnone'; // Just to check wether it works without DOM and XSLT :-) Remove the comments if you want to, too.
        
require_once 'class/'.$sInstance.'.cls.php';
        return new 
$sInstance ($sVersion$sEncoding);
    }
}
?>