示例#1
0
 function showDetails($vars)
 {
     $user = new UserOp();
     $userDetails = $user->load($vars['id']);
     Template::assign('user', $userDetails);
     return 'user/view';
 }
示例#2
0
 public function buildSwatch($swatch)
 {
     if (empty($swatch)) {
         $swatch = $this->defaultSwatch;
     }
     $colors = $this->parseColors($swatch);
     $swatches = '';
     foreach ($colors as $k => $color) {
         Template::assign('swatch' . ($k + 1), $color);
         $swatches .= '<div class="swatch" style="background-color: ' . $color . '" alt="' . $color . '">' . 'swatch' . ($k + 1) . '</div>';
     }
     Template::assign('swatches', $swatches);
 }
示例#3
0
<?php

use Lib\Utils\Template;
$router = new Router\LightRouter();
//$router = new AltoRouter();
require_once SITE_ROOT . '/App/Router/pageRoutes.php';
require_once SITE_ROOT . '/App/Router/authRoutes.php';
require_once SITE_ROOT . '/App/Router/userRoutes.php';
require_once SITE_ROOT . '/App/Router/searchRoutes.php';
require_once SITE_ROOT . '/App/Router/seedRoutes.php';
require_once SITE_ROOT . '/App/Router/testRoutes.php';
require_once SITE_ROOT . '/App/Router/adminRoutes.php';
$match = $router->match();
Template::assign('site', $site);
if ($match === false) {
    // output 404
    $smarty->display('404/404.tpl');
} else {
    list($controller, $action) = explode('#', $match['target']);
    if (is_callable(array('Controllers\\' . $controller, $action))) {
        $template = call_user_func_array(array('Controllers\\' . $controller, $action), array($match['params']));
        if ($template) {
            $smarty->display($template . '.tpl');
        }
    } else {
        echo 'Route Error';
        // here your routes are wrong.
        // Throw an exception in debug, send a  500 error in production
    }
}
 function results()
 {
     $results = Search::go();
     \Lib\Utils\Template::assign('results', $results);
     return 'search/results';
 }
示例#5
0
    Template::assign('$siteStyle', 'site-' . $site->shortname);
}
/*
	Routing
*/
require_once SITE_ROOT . "/App/Router/routing.php";
/**
    Flush memcache if required
*/
if (!empty($flush)) {
    $memc->flush();
    Lib\Redirect::handle('/');
}
$user = Session::get('user');
Template::assign('user', $user);
Template::assign('prelaunch', $site->status == 'prelaunch' ? true : false);
/** 
	error handling 
**/
Template::assign('error', Session::get('error'));
if (Session::get('error')) {
    Session::wipe('error');
}
/** 
	mesage handling 
**/
Template::assign('message', Session::get('message'));
if (Session::get('message')) {
    Session::wipe('message');
}
echo '<br />' . number_format(round(Timer::getTime(), 8), 6);