root/trunk/examples/TestInterfaces.php

Revision 129, 1.1 kB (checked in by mikey, 10 months ago)

renamed XJConfLoader to XJConf

Line 
1 <?php
2 /**
3  * Example that shows how to use same classes with differant tags.
4  *
5  * @author  Stephan Schmidt <stephan.schmidt@schlund.de>
6  * @author  Frank Kleine <frank.kleine@schlund.de>
7  */
8 require_once '../XJConf/XJConf.php';
9 use net::xjconf::DefinitionParser;
10 use net::xjconf::XmlParser;
11 require 'MyClass.php';
12 /**
13  * Example that shows how to use same classes with differant tags.
14  *
15  * @package     XJConf
16  * @subpackage  examples
17  */
18 class TestInterfaces
19 {
20     public static function main()
21     {
22         $tagParser = new DefinitionParser();
23         $defs      = $tagParser->parse(getcwd() . '/xml/defines-interfaces.xml');
24
25         $conf      = new XmlParser();
26         $conf->setTagDefinitions($defs);
27
28         try {
29             $conf->parse(getcwd() . '/xml/test-interfaces.xml');
30         } catch (Exception $e) {
31             echo $e->getMessage();
32             var_dump($e->getTrace());
33             exit(0);
34         }
35         
36         $foo = $conf->getConfigValue('foo');
37         var_dump($foo);
38         var_dump($foo->getBar());
39     }
40 }
41 TestInterfaces::main();
42 ?>
Note: See TracBrowser for help on using the browser.