menu = new FlexyWiki_MenuParser; $this->menu->baseURL = "{$this->rootURL}/wiki.php"; $this->menu->currentPage = '/blog.php'; $this->menu->parseMenu(); $c = DB_DataObject::factory('category'); $cc = clone($c); $cc->aid = "_a_0"; if (!$this->category) { $cc->aid = "active1"; } $cc->category_name="All Categories"; $cc->categoryid = 0; $this->categories = array($cc); $c->find(); while($c->fetch()) { $cc = clone($c); $cc->aid = "_a_".$cc->categoryid; if ($cc->categoryid == $this->category) { $cc->aid = "active1"; } $this->categories[] = $cc; } //DB_DataObject::debugLevel(1); $e = DB_DataObject::factory('entries'); $e->selectAdd(); $e->selectAdd("distinct FROM_UNIXTIME(timestamp,'%M %Y') as ts_when , FROM_UNIXTIME(timestamp,'%Y-%m') as ts_whenT , count(id) as total"); $e->orderBy("ts_whenT DESC"); $e->groupBy("ts_whenT,ts_when"); $e->find(); $this->months = array(); while($e->fetch()) { $m = clone($e); $m->aid = "_a_".$m->ts_when; //echo "TEST: {$this->month} == {$e->ts_whenT}
"; if ($this->month == $e->ts_whenT) { //echo "GOT ACTIVE"; $m->aid = "active1"; } $this->months[] = $m; } } var $categories; function get($u,$args=array()) { //DB_DataObject::debugLevel(1); if ($args) { foreach($args as $k=>$v) { $this->$k=$v; } } $bits = explode('/',$u); if (preg_match('/^[0-9]+-[0-9]+$/', $bits[0])) { $this->month = $bits[0]; } else if(is_numeric($bits[0])) { $this->category = (int) $bits[0]; } $this->loadMenu(); //var_dump($category); /* pages */ $this->loadEntries(); //DB_DataObject::debugLevel(1); } function loadEntries() { // depends on $this->category / [$this->month] being set.. $e = DB_DataObject::factory('entries'); $this->noEntries = $e->count(); $this->curPage = isset($_GET['page']) ? ((int) $_GET['page']) : 1; $this->pages = floor($this->noEntries / 10) ; $this->nextPage = $this->curPage+1; if ($this->nextPage * 10 > $this->noEntries) { $this->nextPage = 0; } $this->prevPage = $this->curPage -1; $e = DB_DataObject::factory('Entries'); if ($this->category) { $e->categoryid = $this->category; } if ($this->month) { $e->having("FROM_UNIXTIME(timestamp,'%Y-%m') = '".$e->escape($this->month)."'"); } $e->limit(($this->curPage -1) * 10,10); $e->orderBy('timestamp DESC'); $e->isdraft = 'false'; $e->find(); $es = array(); while ($e->fetch()) { $ee = clone($e); $ee->referrers = $ee->getReferrers(); $es[] = $ee; } //echo '
';
        //print_r($es);
        $this->entries = $es;
    
    
    
    
    }
    
    function outputBlogBody() {
        return $this->outputBody();
    }
    
    
}