用户名 密码 记住我 还未注册?

news to article [技术论坛 - XOOPS使用]

XOOPS China 讨论区 > XOOPS Core (核心) > XOOPS使用 > news to article

正在浏览:   1 名游客



 到底部   前一个主题   下一个主题  [无发表权] 请登录或者注册



news to article
中级会员
注册日期:
2009/8/3 19:28
所属群组:
注册会员
帖子: 54
等级: 6; EXP: 19
HP: 0 / 129
MP: 18 / 506
离线
入何将 NEWS 模块里的数据导入 article 模块

10/2 22:41
工具箱 短消息 Email PDF 书签 打印 举报 回顶部


回复: news to article
Support Team
注册日期:
2006/11/30 20:48
来自 beijing
所属群组:
网站管理员
注册会员
Dev+Hack
资料整理组
帖子: 1108 | 精华: 16
等级: 29; EXP: 22
HP: 141 / 705
MP: 369 / 8262
离线
第一步:按照模块克隆指南的说明复制"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);
?>

10/2 22:44
工具箱 短消息 Email PDF 书签 打印 举报 回顶部



  [无发表权] 请登录或者注册


不可查看帖子。
不可发帖。
不可回复。
不可编辑自己的帖子。
不可删除自己的帖子。
不可发起投票调查。
不可在投票调查中投票。
不可上传附件。
不可不经审核直接发帖。
不可使用主题类别。
不可使用HTML语法。
不可使用签名档。

[高级搜索]