예제 #1
0
 public function index($args)
 {
     $db = $this->database();
     $s = new model_section($db);
     $p = new model_page($db);
     $md = new markdown_parser();
     $rt = explode("/", $args["_url"]);
     $s->load_from_name(strlen($rt[0]) > 0 ? $rt[0] : "home");
     array_shift($rt);
     $rt = implode("/", $rt);
     $cur_url = strlen($rt) > 0 ? $args["_url"] : $s->default_page();
     $p->load_from_url($cur_url);
     $navs = MODEL_SECTION::get_sections($db);
     $subnavs = $s->get_pages();
     $tpl = new view($this->registry);
     $tpl->set("cur_url", $cur_url);
     $tpl->set("title", $p->title);
     $tpl->set("navs", $navs);
     $tpl->set("subnavs", $subnavs);
     $tpl->set("page", $s->name);
     $tpl->set("content", $p->is_markdown ? array("markdown" => $md->transform($p->content)) : array("html" => $p->content));
     $tpl->set("s_intro", $md->transform($s->introduction));
     $tpl->set("s_img", $s->image);
     $tpl->show("default");
 }
예제 #2
0
 public function index($args)
 {
     $db = $this->database();
     $s = new model_section($db);
     $p = new model_page($db);
     $md = new markdown_parser();
     $rt = explode("/", $args["_url"]);
     $s->load_from_name(strlen($rt[0]) > 0 ? $rt[0] : "home");
     array_shift($rt);
     $rt = implode("/", $rt);
     $cur_url = strlen($rt) > 0 ? $args["_url"] : $s->default_page();
     $p->load_from_url($cur_url);
     $navs = MODEL_SECTION::get_sections($db);
     $subnavs = $s->get_pages();
     $tpl = new view($this->registry);
     if ($args["article"]) {
         # Loading and displaying an article.
         $a = new model_article($db, $args["article"]);
         $tpl->set("content", array("markdown" => $md->transform($a->body)));
         $tpl->set("title", $a->title);
     } else {
         # Listing articles.
         switch ($args["_url"]) {
             case "projects/other.html":
                 $listed = array(8, 9, 14);
                 $subtitle = "Other";
                 break;
             default:
                 $listed = array(13, 12, 11, 10, 15, 16, 17);
                 $subtitle = "KT-EQUAL";
                 break;
         }
         $projects = array();
         $projects = MODEL_ARTICLE::get_articles($db, $listed);
         $tpl->set("include", "subviews/project_list.php");
         $tpl->set("projects", $projects);
         $tpl->set("title", $subtitle . " Projects");
     }
     $tpl->set("cur_url", $cur_url);
     $tpl->set("navs", $navs);
     $tpl->set("subnavs", $subnavs);
     $tpl->set("page", $s->name);
     $tpl->set("s_intro", $md->transform($s->introduction));
     $tpl->set("s_img", $s->image);
     $tpl->show("default");
 }
예제 #3
0
 public function view($args)
 {
     $template = new view($this->registry);
     $db = $this->database();
     $sth = $db->prepare("\n\t\t\tSELECT \tid, title, body, author, date, publisher\n\t\t\tFROM \tarticles\n\t\t\tWHERE\tid = :id\n\t\t\tLIMIT \t1\n\t\t");
     $sth->execute(array(":id" => $args["id"]));
     $article = $sth->fetch();
     $template->set("page_title", "Look At That F***ing Title");
     $template->set("title", utf8_encode($article["title"]));
     $p = new markdown_parser();
     $s = new markdown_smartypantstypographer();
     include SITE_PATH . DIRSEP . "definitions" . DIRSEP . "article.php";
     $body_text = $p->transform($s->transform($article["body"]));
     $article_info = sprintf(HTML_ARTICLE_INFO, $article["author"], $article["date"], $article["publisher"]);
     $template->set("info", $article_info);
     $template->set("body", utf8_encode(sprintf(HTML_ARTICLE_BODY, $body_text)));
     $template->show("home");
 }
예제 #4
0
	/**
	*	@param string content Markdown content
	*/
	public function __construct($content, $options = array()){	
		$lines = explode("\n", $content);	
		parent::__construct($lines, $options);
	}