Example #1
0
 /**
 		Load a tpl file and parse its content
 			@param $file string
 	**/
 static function serve($file)
 {
     if (is_file($file)) {
         self::$text = file_get_contents($file);
         echo self::parse();
     } else {
         phex::error(404);
     }
 }
Example #2
0
            $thisitem = $item[0];
            $nextitem = $item[1];
            return $recursive ? array($thisitem => self::set($nextitem, $value, true)) : (self::$P[$thisitem] = self::set($nextitem, $value, true));
        } else {
            return $recursive ? array($item => $value) : (self::$P[$item] = $value);
        }
    }
    /**
    		Show an error
    			@param $code integer
    	**/
    static function error($code)
    {
        switch ($code) {
            case 404:
                header('HTTP/1.0 404 Not Found');
                echo "NOT FOUND";
                break;
            default:
                break;
        }
        exit;
    }
}
/**
	Default configuration
**/
phex::set('AUTOLOAD', '');
phex::set('VERSION', '0.0.2');
phex::set('ACCEPTED_METHODS', array('GET', 'POST'));
Example #3
0
<?php

require_once '../lib/phex.php';
function test()
{
    echo "This is a test";
}
phex::set('TEST.ARRAY.VAR.VAR2', "valoresss");
phex::set('NOARRAY', "valore");
//phex::config('config.ini');
phex::routeGET("test", "/", function () {
    phex_tpl::serve("template.html");
});
//phex::route("test", "/", "example::test");
phex::route("test", "/@test1/ciao/test2", 'test');
phex::route("test", "/@test1/@plutone/@test2", 'test');
phex::route("test", "/@test1/ciao/@test2", 'test');
phex::run();
//echo phex::get('INI_ARRAY.TEST');