PHP Classes

File: Example

Recommend this page to a friend!
  Classes of JoseX20   Configuracion   Example   Download  
File: Example
Role: Example script
Content type: text/plain
Description: Example Configuration
Class: Configuracion
Generate PHP scripts with configuration values
Author: By
Last change:
Date: 13 years ago
Size: 711 bytes
 

Contents

Class file image Download
<?php
/*
 * Example Configuracion.php
 *
 * Created By Jose Perez - http://www.codigo-source.net/
 *
 */

//Include all the class in the directory
function __autoload($file_name){
    include
"$file_name.php";
}

//Create the object
$conf = new Configuracion("config");

//Add variable and value without '$' as String
//The first value always must String
$conf->addVariable("name", "Joseph");
$conf->addVariable("country", "Chile");
//Number Value
$conf->addVariable("age", 21);
//Boolean Value must write as strings
$conf->addVariable("isdead", 'false');

//Write the file
$bool = $conf->generarArchivo();

if(!
$bool){
    echo
'The file '.$conf->namefile.'.php was created!';
} else {
    echo
'Error!';
}

?>