Beispiel #1
0
     $key = $_GET['k'];
     $q = array('fields' => '*', 'table' => TRACKBACK_TABLE . ' AS t', 'title' => 't.title', 'comment' => 't.excerpt', 'date' => 't.date', 'draft' => 't.trash', 'group_by' => 't.blog_id');
     $resultViewFile = 'search-result.html';
     $sql = $app->getSearchSQL($q);
     $sql2 = $app->getSearchHitsSQL($q);
 }
 if ($res = $app->db->query($sql)) {
     // Get the number of hit results
     $res2 = $app->db->query($sql2);
     $totalItemsCount = count($res2->fetchAll());
     //$res2->numRows();
     //echo $totalItemsCount;
     // Archive By Date
     if (preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}/', $date)) {
         $contents = $app->getArchives($res);
         $pager = $app->getPager($totalItemsCount, $pageNumberToShow, $date, $expand);
         $result = '';
     } else {
         $contents = $app->getArchives($res);
         $pager = $app->getPager($totalItemsCount, $pageNumberToShow, $date, $expand);
         $result = new Loggix_View($pathToIndex . '/theme/' . $resultViewFile);
         $item = $app->setSearchItems($res, $totalItemsCount, $previousItemNumber, $date);
         $result->assign('item', $item);
         $result->assign('lang', $lang);
         $result = $result->render();
     }
     // Contents, Pager, and Results
     $item['contents'] = $contents;
     $item['pager'] = $pager;
     $item['result'] = $result;
     $item['title'] = !empty($_GET['c']) ? $app->setTitle(array($item['keyword'], $lang['archive'])) : $app->setTitle($lang['archive']);