Beispiel #1
0
 /**
  * Sets the path to search for templates.
  *
  * @param  string
  */
 public static function setPath($path)
 {
     if (!is_dir($path)) {
         throw new RPG_Exception('Specified template path does not exist.');
     }
     self::$_path = $path;
 }
Beispiel #2
0
 /**
  * Sets the layout template file to use.
  *
  * @param  string $layout Path to the layout template file, relative to
  *                        the template path.
  */
 public function setLayout($layout = '')
 {
     if ($layout === '') {
         $layout = 'layouts/empty.php';
     }
     if (file_exists(RPG_Template::getPath() . "/{$layout}")) {
         $this->_layout = RPG::template($layout);
     } else {
         throw new RPG_Exception('Specified layout "' . $layout . '" does not exist.');
     }
     $this->setContent('');
     return $this;
 }
Beispiel #3
0
    require RPG_LIBRARY_PATH . '/RPG/Session/Hybrid.php';
}
// Set up the error handler
set_error_handler(array('RPG', 'handlePhpError'));
// Default configuration items
$defaultConfig = array('modelPath' => RPG_ROOT . '/models', 'viewPath' => RPG_ROOT . '/views', 'controllerPath' => RPG_ROOT . '/controllers', 'cachePath' => RPG_ROOT . '/cache', 'tmpPath' => RPG_ROOT . '/tmp', 'sessionPath' => RPG_ROOT . '/tmp/sessions', 'objectsPath' => RPG_ROOT . '/cache/objects');
// Override defaults if needed
$config = array_merge($defaultConfig, $config);
//
// Start the main execution!
// Top-level try/catch block for a last-ditch effort error page.
//
try {
    // Initialize the system
    RPG::setConfig($config);
    RPG_Template::setPath($config['viewPath']);
    RPG_Model::setPath($config['modelPath']);
    RPG::session();
    RPG::user(RPG::model('user'));
    // add this now, so controllers can include CSS that overrides defaults
    RPG::view()->addStyleSheet('media/styles/light.css');
    // Process the request
    RPG::router($config['controllerPath'])->processRequest();
    // stop the timer - needs to be here so it can get rendered via templates
    RPG::debug('Execution Time (pre-render): ' . round(microtime(true) - RPG::get('__debug_time'), 4));
    // Render the output - TODO: handle styles differently later
    RPG::view()->render();
} catch (RPG_Exception $ex) {
    // Basic error page
    echo '<html>
<head>