예제 #1
0
 function index()
 {
     $page = isset($_GET['page']) ? tin($_GET['page']) : 1;
     $limit = 10;
     $begin = ($page - 1) * $limit;
     $bm = new BlogModel();
     $arrB = $bm->getWhere("topic_status = 'publish' ORDER BY topic_date DESC LIMIT {$begin},{$limit}");
     $jml = $bm->getJumlah("topic_status = 'publish'");
     $bc = new BlogCategory();
     $dis = $bc->getWhere("cat_active=1");
     //        $dis = $bm->getDistinct("topic_category","topic_category ASC");
     $jmlpage = ceil($jml / $limit);
     //        pr($arrB);
     //        pr($dis);
     $arr['posts'] = $arrB;
     $arr['cat'] = $dis;
     $arr['page'] = $page;
     $arr['begin'] = $begin;
     $arr['limit'] = $limit;
     $arr['jmlpage'] = $jmlpage;
     $arr['jml'] = $jml;
     $directory = get_called_class() . "_" . __FUNCTION__;
     //        echo "<br><br><br>";
     //        echo $directory;
     //        Mold::theme("Pages/".$directory.)
     $layout_id = "Blog_index";
     $file = Layout::getFile($layout_id);
     //        echo "Pages/".$layout_id."/".$file;
     Mold::theme("Pages/" . $layout_id . "/" . $file, $arr);
     //        Mold::theme("Pages/Blog_index",$arr);
 }
예제 #2
0
    function prefetchBlogCat()
    {
        $cal = new BlogCategory();
        $arr = $cal->getWhere("cat_active=1");
        $cc = array();
        foreach ($arr as $c) {
            $cc[] = $c->cat_id;
        }
        echo json_encode($cc);
        die;
        ?>
[ "Amsterdam",
"London",
"Paris",
"Washington",
"New York",
"Los Angeles",
"Sydney",
"Melbourne",
"Canberra",
"Beijing",
"New Delhi",
"Kathmandu",
"Cairo",
"Cape Town",
"Kinshasa"
]<?php 
        die;
    }