PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Chavo   Simple YAML Config Reader   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Simple YAML Config Reader
Read configuration settings from YAML files
Author: By
Last change:
Date: 17 years ago
Size: 1,142 bytes


Class file image Download
//include the class file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

<html xmlns="">
  <title>YAML Config Class Example</title>
if ($_GET["action"]=="show") {
//initialize the class
$settings = Settings::singleton();
//printout all collected settings
print("<h1>CONFIGURATION SETTINGS FROM [".$settings->config_file."]:</h1><pre>");
        print (
        print (
"<h2>Dumping strings from [".$settings->localization_file."]:</h2><p>");
//note that $l is a global variable, declared and made available by the Settings class
foreach($l as $key=>$value) {
            print (
"$key => $value<br>");
        print (

<p><strong>Click to view configuration settings and localization strings in: <a href="?action=show&amp;lang=en">English</a> / <a href="?action=show&amp;lang=fr">French</a></strong></p>