PHP Classes

File: contents/themes/simplecolor/model/category.php

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

 

Contents

Class file image Download
<?php

function searchResult($id)
{
  $curPage=0;

  $keywords='';

  if($matches=Uri::match('category-(\d+)-\w+-page-(\d+)'))
  {
    $curPage=$matches[2];

    $keywords=$matches[1];
  }
  else
  {
    $keywords=$id;
  }

  $loadData=Post::get(array(
    'limitShow'=>10,
    'limitPage'=>$curPage,
    'where'=>"where catid='$keywords'"
    ));

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

  return $loadData;
}

function listPage()
{
  $curPage=0;

  $id=0;

  $friendly_url='';

  if($matches=Uri::match('category-(\d+)-([a-zA-Z0-9_-]+)-page-(\d+)'))
  {
    $curPage=$matches[3];

    $id=$matches[1];

    $friendly_url=$matches[2];

  }elseif($matches=Uri::match('category-(\d+)-([a-zA-Z0-9_-]+)'))
  {
    $id=$matches[1];

    $friendly_url=$matches[2];
  }

  $listPage=Misc::genPage('category-'.$id.'-'.$friendly_url,$curPage,5,'-'); 

  return $listPage;

}


?>