PHP Classes

File: test_reader.php

Recommend this page to a friend!
  Classes of Keyvan Minoukadeh   Config Manager   test_reader.php   Download  
File: test_reader.php
Role: ???
Content type: text/plain
Description: example of using the config reader class
Class: Config Manager
Sorry, no longer supported
Author: By
Last change:
Date: 21 years ago
Size: 1,087 bytes
 

Contents

Class file image Download
<?php require_once('class.config_base.php'); require_once('class.config_reader.php'); $config_file = 'valid_config.txt'; // $config_file = 'invalid_config.txt'; // load config file $reader = new config_reader($config_file); // turn debuggin on $reader->set('debug', true); echo "<pre>\n"; // check if valid if ($reader->is_valid()) { echo "CONFIG '".$reader->get('config')."' IS VALID :)\n"; echo "<a href=\"{$config_file}\">View Config</a> - "; echo "<a href=\"test_webedit.php\">Edit with web editor</a>\n\n"; // load config $c = $reader->load(); // dump variable var_dump($c); } else { echo "CONFIG '".$reader->get('config')."' IS INVALID :(\n"; echo "<a href=\"{$config_file}\">View Config</a> - "; echo "<a href=\"test_webedit.php\">Edit with web editor</a>\n\n"; // get invliad line nubers // arg1: config file array (null: use existing) // arg2: return line numbers (default: false) $invalid = $reader->is_valid(null, true); echo "Invalid lines:\n"; echo implode(', ', $invalid); } echo "\n</pre>"; ?>