Beispiel #1
0
        $template = file_get_contents($GLOBALS['template_dir'] . "/base_page.txt");
        $title = $cat . " search '" . $search . "' page " . $page . " - " . $_SERVER['HTTP_HOST'];
        $desc = $_SERVER['HTTP_HOST'] . " - browse " . $cat . " search '" . $search . "' page " . $page;
        if ($mongo_results) {
            //need to special chars anything using $search param that gets inserted into HTML
            $tmplt_data = array();
            $tmplt_data["title"] = htmlspecialchars($title, ENT_QUOTES);
            $tmplt_data["description"] = htmlspecialchars($desc, ENT_QUOTES);
            $tmplt_data["styles"] = "";
            $tmplt_data["scripts"] = "";
            $tmplt_data["base"] = $base;
            $tmplt_data["category"] = $cat;
            $tmplt_data["search_placeholder"] = htmlspecialchars("search " . $cat, ENT_QUOTES);
            $tmplt_data["search_value"] = htmlspecialchars($search, ENT_QUOTES);
            $tmplt_data["header"] = $post_views->getCatHeaderList($cat);
            $tmplt_data["body"] = $mongo_results;
            $full_page = TemplateBinder::bindTemplate($template, $tmplt_data);
            echo $full_page;
        } else {
            //if mongo results are false go to 404,	logic in getHomePagePosts Funtion
            goTo404();
        }
    } catch (MongoException $e) {
        //echo $e->getMessage();
        //Mongo error, go to 404 page
        goTo404();
    }
} else {
    //wrong amount of URL params
    goTo404();
}
Beispiel #2
0
 public function getCatHeaderList($cat = "")
 {
     $categories = $GLOBALS['post_categories'];
     $count = count($categories);
     $str = "";
     $li_tmplt = '<li class="{{ added_class }}" ><a href="/{{ current_cat }}/1" data-blogaction="category-link" >{{ uc_cat }}</a></li>';
     for ($i = 0; $i < $count; $i++) {
         $current_cat = $categories[$i];
         $data = array("current_cat" => $current_cat, "uc_cat" => ucwords($current_cat), "added_class" => $cat === $current_cat ? "current-cat" : "");
         $str .= TemplateBinder::bindTemplate($li_tmplt, $data);
     }
     return $str;
     //just the lis of the list
 }