PHP Classes

File: contents/themes/simplecolor/controller/themeHome.php

Recommend this page to a friend!
  Packages of Minh Tien   Noblesse CMS   contents/themes/simplecolor/controller/themeHome.php   Download  
File: contents/themes/simplecolor/controller/themeHome.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Noblesse CMS
Content management system with custom plugins
Author: By
Last change: Improve system
Date: 11 years ago
Size: 1,205 bytes
 

 

Contents

Class file image Download
<?php

class themeHome
{
    public function index()
    {
        // Cache::loadPage('',30);

        $inputData=array();

        $curPage=0;

        Model::loadWithPath('home',System::getThemePath().'model/');

        if($match=Uri::match('page\/(\d+)'))
        {
            $curPage=(int)$match[1];
        }

        $curPage=((int)$curPage >= 0)?$curPage:0;

        $inputData['newPost']=Post::get(array(
            'isHook'=>'yes',
            'cache'=>'yes',
            'cacheTime'=>180,
            'limitShow'=>10,
            'limitPage'=>$curPage
            ));


        if(!isset($inputData['newPost'][0]['postid']))
        {
            Redirect::to('404page');
        }

        $total=count($inputData['newPost']);

        for ($i=0; $i < $total; $i++) { 
            $inputData['newPost'][$i]['date_addedFormat']=date('d M,Y',strtotime($inputData['newPost'][$i]['date_added']));
        }

        $inputData['listPage']=Misc::genPage('',$curPage);

        self::makeContent('home',$inputData);

        // Cache::savePage();
    }

    public function makeContent($viewName,$inputData=array())
    {
        // View::onCache();
        
        $themePath=System::getThemePath().'view/';

        $inputData['themePath']=$themePath;

        View::makeWithPath('head',array(),$themePath);

        View::makeWithPath($viewName,$inputData,$themePath);

        View::makeWithPath('footer',array(),$themePath);

    }


}

?>