36 lines
803 B
PHP
36 lines
803 B
PHP
<?php namespace Project\Controllers;
|
|
use URI,DB,Cookie,URL,Method;
|
|
|
|
class content extends Controller{
|
|
function main(){
|
|
$id = explode('-',URI::get('content'));
|
|
$id = $id['0'];
|
|
|
|
$row = contentRow($id);
|
|
if (!$row) {
|
|
return Masterpage::error404();
|
|
}
|
|
|
|
if (Cookie::select('contentid') != $id) {
|
|
$hits = $row->hits + 1;
|
|
DB::where('id', $id)->update('content',['hits' => $hits]);
|
|
Cookie::time(60 * 60 * 24)->insert('contentid',$id);
|
|
}
|
|
|
|
Masterpage::title($row->title);
|
|
Masterpage::meta
|
|
([
|
|
'name:description' => $row->keywords,
|
|
'name:keywords' => $row->label
|
|
]);
|
|
|
|
define('TITLE',$row->title);
|
|
define('LINK',URL::base("content/$id-".$row->title_seo));
|
|
define('DESC',$row->keywords);
|
|
define('IMG',content_image($row->content));
|
|
|
|
view::id($id);
|
|
}
|
|
|
|
|
|
} |