Location: PHPKode > scripts > Config Manager > config-manager/test_reader.php
<?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>";

?>
Return current item: Config Manager