コード例 #1
0
ファイル: yf_tpl_driver_blitz.class.php プロジェクト: yfix/yf
 /**
  */
 function parse($name, $replace = [], $params = [])
 {
     if (!class_exists('Blitz')) {
         return $params['string'];
     }
     if ($params['string']) {
         $view = new Blitz();
         $view->load($params['string']);
         return $view->parse($replace);
     }
     // TODO: test me and connect YF template loader
 }
コード例 #2
0
ファイル: WebModule.php プロジェクト: BikeMaker/Code
    static function returnError($e)
    {
        $template = new \Blitz();
        $template->load(<<<BODY
<html>
\t<head>
\t\t<title>Error {{ \$ErrorNum }}</title>
\t</head>
\t<body>
\t\t<h3>{{ \$ErrorTitle }}</h3>
\t\t<pre>{{ \$ErrorMessage }}</pre>
\t</body>
</html>
BODY
);
        $template->display(array('ErrorNum' => $e->getCode(), 'ErrorTitle' => $e->getLine() . ' : ' . $e->getFile(), 'ErrorMessage' => $e->getMessage() . PHP_EOL . $e->getTraceAsString()));
    }
コード例 #3
0
ファイル: index.php プロジェクト: kupnu4x/dcsearch
set_time_limit(0);
define('RPP', 50);
require_once dirname(__FILE__) . '/inc/config.inc';
$page = isset($_GET['p']) ? (int) $_GET['p'] : 1;
$query = isset($_GET['q']) ? (string) $_GET['q'] : '';
$category = isset($_GET['cat']) ? (string) $_GET['cat'] : '';
$days = isset($_GET['d']) ? (int) $_GET['d'] : 0;
$days = max($days, 0);
$minsize = isset($_GET['minsize']) ? (string) $_GET['minsize'] : '0.1 GB';
if (!Searcher::correctHumanSize($minsize)) {
    $minsize = '0';
}
$extsearch = isset($_GET['extsearch']) ? (bool) $_GET['extsearch'] : false;
$nodirs = isset($_GET['nodirs']) ? (bool) $_GET['nodirs'] : false;
$T = new Blitz();
$T->load(file_get_contents('tpl/index.tpl'));
$tpl_values = array();
$tpl_values['page'] = $page;
if ($query || $extsearch) {
    $tpl_values['query'] = htmlspecialchars($query);
    $tpl_values['extsearch'] = $extsearch;
    $tpl_values['nodirs'] = $nodirs;
    $categories = Searcher::getCategories($category, true);
    $tpl_values['categories'] = $categories;
    $tpl_values['days'] = $days;
    $tpl_values['minsize'] = $minsize;
    if ($query) {
        $searcher = new SphinxClient();
        $searcher->setServer("localhost", 3312);
        $searcher->setMatchMode(SPH_MATCH_ALL);
        $searcher->setSortMode(SPH_SORT_RELEVANCE);