public static function tag( $args ) { $tag = str_replace('_', ' ', urldecode($args[0])); $filtred = array(); $post = ModelHandler::get("Posts"); for ($i = 0; $i < count($post); $i++) { $tags = explode(',', $post[$i]->bean['tags']); if(in_array($tag, $tags) ) $filtred[] = $post[$i]; } $post = $filtred; for ($i = 0; $i < count($post); $i++) { $newtags = ""; $tags = explode(',', $post[$i]->bean['tags']); foreach ($tags as $tag) { $newtags .= "<a href='/?/posts/tag/".$tag."'>".$tag."</a>, "; } $post[$i]->bean['tags'] = substr($newtags, 0, strlen($newtags)-2); } $post = array_reverse($post); $content = ViewHandler::wrapGroup("post", $post); Template::reset(); Template::assign("content",$content); Template::assign("allpostslink",""); echo Template::render("main.html"); }
public static function getDashboard() { $items = ModelHandler::get("Users"); $a = ViewHandler::wrapGroup("DashboardListItem", $items); $view = ViewHandler::getView("Users", self::$dashboardView); $dashboard = str_replace("<? echo \$listbody;?>", $a, $view); $dashboard = str_replace("<? echo \$count;?>", count($items), $dashboard); return $dashboard; }
public static function getDashboard() { $items = ModelHandler::get("Posts"); foreach ($items as $item) { $item->bean['content'] = strip_tags($item->bean['content']); $length = strlen($item->bean['content']); if( $length > 203 ){ $s = substr($item->bean['content'], 0, 200); $s = substr($s, 0, strrpos($s, " "))."..."; $item->bean['content'] = $s; } } $items = array_reverse($items); $a = ViewHandler::wrapGroup("DashboardListItem", $items); $view = ViewHandler::getView("Posts", self::$dashboardView); $dashboard = str_replace("<? echo \$listbody;?>", $a, $view); $dashboard = str_replace("<? echo \$count;?>", count($items), $dashboard); return $dashboard; }