Example #1
0
<?php

date_default_timezone_set('America/Los_Angeles');
$basePath = dirname(dirname(__FILE__));
$libraryPath = sprintf('%s/libraries', $basePath);
$epiPath = sprintf('%s/epi', $libraryPath);
require sprintf('%s/Epi.php', $epiPath);
Epi::setPath('base', $epiPath);
Epi::setPath('view', sprintf('%s/templates', $basePath));
Epi::setSetting('exceptions', true);
Epi::init('api', 'cache', 'config', 'logger', 'route', 'session', 'template', 'database');
EpiSession::employ(EpiSession::PHP);
require sprintf('%s/initialize.php', $libraryPath);
getRoute()->run();
Example #2
0
<?php

chdir('..');
include_once '../src/Epi.php';
Epi::setPath('base', '../src');
Epi::setSetting('debug', true);
Epi::init('route', 'debug');
getRoute()->get('/', array('MyClass', 'MyMethod'));
getRoute()->get('/sample', array('MyClass', 'MyOtherMethod'));
getRoute()->get('/somepath/source', array('MyClass', 'ViewSource'));
getRoute()->run();
echo '<pre>';
echo getDebug()->renderAscii();
echo '</pre>';
/*
 * ******************************************************************************************
 * Define functions and classes which are executed by EpiCode based on the $_['routes'] array
 * ******************************************************************************************
 */
class MyClass
{
    public static function MyMethod()
    {
        echo '<h1>You are looking at the output from MyClass::MyMethod</h1>
          <ul>
            <li><a href="/debug">Call MyClass::MyMethod</a></li>
            <li><a href="/debug/sample">Call MyClass::MyOtherMethod</a></li>
            <li><a href="/debug/somepath/source">View the source of this page</a></li>
            </ul>
            <p><img src="https://github.com/images/modules/header/logov3-hover.png"></p>';
    }