Example #1
0
 function getCategoryPages($is_page = false)
 {
     // a page needs the tag "category" to jump into this behaviour
     if ($is_page && !$this->category) {
         return false;
     }
     $page = new Page();
     $page->tablename = "pages";
     // add a leading slash to the path
     $path = substr($this->data['path'], -1) == "/" ? $this->data['path'] : $this->data['path'] . '/';
     $pages = $page->retrieve_many("path like '" . $path . "%'");
     // FIX: reset the data (in case it has page info)
     if ($is_page) {
         $this->data['body'] = array();
     }
     if (count($pages) > 0) {
         foreach ($pages as $data) {
             $data['view'] = getPath('views/main/category.php');
             $this->data['body'][] = $data;
         }
         // everything checked out - ready to set the template
         $this->data['template'] = "category.php";
         return true;
     } else {
         return false;
     }
 }
Example #2
0
 function requestAllPages()
 {
     $page = new Page();
     $page->tablename = "pages";
     $pages = $page->retrieve_many("date LIKE '%" . $this->data['date'] . "%'");
     $view = getPath('views/archives/body.php');
     foreach ($pages as $data) {
         $data['view'] = $view;
         $this->data['body'][] = $data;
     }
 }
Example #3
0
 public static function getBody($path)
 {
     // pls replace strng $path with proper params array (make parameter generation more abstruct)
     $items = array();
     $tag = preg_replace('#^tag/#', '', $path);
     $page = new Page();
     $page->tablename = "pages";
     $pages = $page->retrieve_many("tags like '%" . $tag . "%'");
     $view = getPath('views/tag/body.php');
     foreach ($pages as $data) {
         $data['view'] = $view;
         $items[] = $data;
     }
     return $items;
 }