文章管理 V1

如何用article模块替代新闻管理

类别: 文章管理
作者: D.J.
日期: 11月05日
article是一个完善的文章、新闻以及blog管理模块。可以采用article替代XOOPS传统的news模块,主要涉及到数据的转换、相关模块wfdownloads的调整和backend.php的修改
关键词: news article

摘要: article是一个完善的文章、新闻以及blog管理模块。可以采用article替代XOOPS传统的news模块,主要涉及到数据的转换、相关模块wfdownloads的调整和backend.php的修改

第一步:按照模块克隆指南的说明复制"news"模块

第二步:(如果是全新安装news,可以跳过此步)运行 XOOPS/modules/news/import/news.php

第三步:升级(或全新安装)news模块

第四步:设置/调整模块权限和区块设置

第五步:修改XOOPS/backend.php(代码附后)

第六步:如果使用wfdownloads模块,用后边的代码替换 /wfdownloads/admin/newstory.php 的内容


附一:将下列代码添加到XOOPS/backend.php头部

chdir
("./modules/news/");
$_SERVER'PHP_SELF' ] = dirname($_SERVER'PHP_SELF' ])."/modules/news/xml.php";
$_SERVER'REQUEST_URI' ] = $_SERVER'PHP_SELF' ]."?rss";
include 
"xml.php";
exit();


附二:用下列代码替换/wfdownloads/admin/newstory.php
<?php
$category_handler 
=& xoops_getmodulehandler("category""news");
$cat_id = isset($_POST["cat_id"]) ? intval($_POST["cat_id"]) : ;
$category_obj =& $category_handler->get($cat_id);
$isModerator $category_handler->getPermission($category_obj"submit");
if( !
$category_handler->getPermission($category_obj,"submit") ) {
    return;
}

$article_handler =& xoops_getmodulehandler("article""news");
$article_obj =& $article_handler->create();
$article_obj->setVar("art_title"$title);
$art_summary $_POST["description"]. "rnrn".$title."";
$article_obj->setVar("art_summary"$art_summary);
$article_obj->setVar("cat_id"$cat_id);
$article_obj->setVar("uid"$xoopsUser->getVar("uid"));
$article_obj->setVar("art_time_create"time());
$article_obj->setVar("art_time_submit"time());
$article_obj->setVar("art_time_publish"time());
$art_id_new $article_handler->insert($article_obj);

$cats[$cat_id] = array( "status" => 1"uid" => $article_obj->getVar("uid") );
$article_handler->registerCategory($article_obj$cats);
$article_handler->updateCategories($article_obj);

$text_handler =& xoops_getmodulehandler("text""news");
$text_obj =& $text_handler->create();
$text_obj->setVar("art_id"$article_obj->getVar("art_id"));
$text_obj->setVar("dobr"1);
$text_obj->setVar("text_body"$art_summary);
$text_id $text_handler->insert($text_obj);

$article_obj->setVar("art_pages", array($text_id), true); // NOT GPC, important!
$article_handler->insert($article_obj);
?>

文章管理 V1
URL: http://xoops.org.cn/modules/article/view.article.php/c2/16