phpcms网站管理系统
很不错的 有需要的就下载看看八
源代码在线查看: article.php
/*
*####################################################
* PHPCMS v3.0.0 - Advanced Content Manage System.
* Copyright (c) 2005-2006 phpcms.cn
*
* For further information go to http://www.phpcms.cn/
* This copyright notice MUST stay intact for use.
*####################################################
*/
if(!$_CHA[htmlcreatetype]) return false;
$articleid = intval($articleid);
if(!$articleid) return false;
$r = $db->get_one("SELECT * FROM ".TABLE_ARTICLE." WHERE articleid=$articleid and channelid=$channelid");
if(!$r['articleid']) return false;
@extract($r);
if($linkurl)
{
$p->set_type("path");
$filepath = $p->get_itemurl($articleid,$addtime);
$f->create(dirname($filepath));
file_write($filepath,"location.href='".$linkurl."';");
return true;
}
$templateid = $templateid ? $templateid : $_CAT['defaultitemtemplate'];
$skinid = $skinid ? $skinid : $_CAT['defaultitemskin'];
$skindir = $skinid ? PHPCMS_PATH."skin/".$skinid : $skindir;
$p->set_catid($catid);
$adddate = date('Y-m-d H:i:s',$addtime);
$position = cat_posurl($catid);
$p->set_type("url");
$itemurl = "http://".$PHP_DOMAIN.$p->get_itemurl($articleid,$addtime);
$meta_title = $title."-".$_CHA['channelname'];
$meta_keywords = $keywords.",".$_CAT['meta_keywords'].",".$_CHA['meta_keywords'].",".$_CHA['channelname'];
$meta_description = $_CAT['meta_description']."-".$_CHA['meta_description']."-".$_CHA['channelname'];
if($paginationtype==1)
{
$charnumber = strlen($content);
$pagenumber = ceil($charnumber/$maxcharperpage);
$contents = $content;
}
elseif($paginationtype==2)
{
$contents = explode('[next]',$content);
$pagenumber = count($contents);
}
if($pagenumber>1)
{
for($i=0;$i {
$page = $i+1;
if($paginationtype==1)
{
$start = $i*$maxcharperpage;
$end = $page*$maxcharperpage;
$end = $end > $charnumber ? $charnumber : $end;
$content = get_substr($contents,$start,$end);
}
elseif($paginationtype==2)
{
$content = $contents[$i];
}
ob_start();
$p->set_type("url");
$pages = articlepage($articleid,$addtime,$pagenumber,$page);
include template($templateid,"article","content");
$data = ob_get_contents();
ob_clean();
$p->set_type("path");
$filepath = $p->get_itemurl($articleid,$addtime,$page);
$f->create(dirname($filepath));
file_write($filepath,$data);
}
}
else
{
ob_start();
$p->set_type("url");
include template($templateid,"article","content");
$data = ob_get_contents();
ob_clean();
$p->set_type("path");
$filepath = $p->get_itemurl($articleid,$addtime);
$f->create(dirname($filepath));
file_write($filepath,$data);
}
return TRUE;
?>