Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  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: 8 years ago
Size: 1,142 bytes
 

Contents

Class file image Download
<?php
//include the class file
include_once("settings.class.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>YAML Config Class Example</title>
</head>
<body>
<?php
    
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_r($settings->get);
        print (
"</pre>");
        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>");
    }

?>
<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>
</body>

</html>