|
本帖最后由 eivac 于 2011-3-22 16:11 编辑
先说下我的难处... 我这边有实体人才市场,市场上有几面墙都是玻璃的,空那也是空,于是全做成了橱窗招聘,所谓"贴板招聘" 每天都有很多人去看,但是针对一些企业会员,贴板上有的网站上也要及时出现.嘉缘系统从6.0我就提出了是不是资讯栏目也跟公告一样可以出个天数限制.但是到PHP2.1还没有,只好自己瞎琢磨修改了,会的人看了一点也不难就是把公告的天数功能搬到资讯.
开源版的朋友按照以下方法修改即可
一:
在MYsql 中 找到 job_news 表 添加一个字段 a_outtime 长度10 as_defined: 0 保存
二:
admin/info_main.de.php 中
1. 找到 40行
{
$rs = $db->query( "INSERT INTO ".$cfg['tb_pre']."news (n_title,n_content,n_overview,n_sorttit,n_color,n_cid,n_sid,n_author,n_editor,n_from,n_pic,n_addtime,n_iscomm,n_ispic,n_ishome,n_keywords,n_description,a_outtime) VALUES('{$title}','{$content}','{$overview}','{$sorttit}','{$color}','{$cid}','{$sid}','{$author}','{$editor}','{$from}','{$pic}','{$addtime}','{$iscomm}','{$ispic}','{$ishome}','{$keywords}','{$description}','{$outtime}')" );
$nid = $db->insert_id( );
}
else
{
$rs = $db->query( "update ".$cfg['tb_pre']."news set n_title='{$title}',n_content='{$content}',n_overview='{$overview}',n_sorttit='{$sorttit}',n_color='{$color}',n_sid='{$sid}',n_author='{$author}',n_editor='{$editor}',n_from='{$from}',n_pic='{$pic}',n_addtime='{$addtime}',n_iscomm='{$iscomm}',n_ispic='{$ispic}',n_ishome='{$ishome}',n_keywords='{$keywords}',n_description='{$description}' where n_id={$nid}" );
}
改成 :
{
$rs = $db->query( "INSERT INTO ".$cfg['tb_pre']."news (n_title,n_content,n_overview,n_sorttit,n_color,n_cid,n_sid,n_author,n_editor,n_from,n_pic,n_addtime,n_iscomm,n_ispic,n_ishome,n_keywords,n_description,a_outtime) VALUES('{$title}','{$content}','{$overview}','{$sorttit}','{$color}','{$cid}','{$sid}','{$author}','{$editor}','{$from}','{$pic}','{$addtime}','{$iscomm}','{$ispic}','{$ishome}','{$keywords}','{$description}','{$outtime}')" );
$nid = $db->insert_id( );
}
else
{
$rs = $db->query( "update ".$cfg['tb_pre']."news set n_title='{$title}',n_content='{$content}',n_overview='{$overview}',n_sorttit='{$sorttit}',n_color='{$color}',n_sid='{$sid}',n_author='{$author}',n_editor='{$editor}',n_from='{$from}',n_pic='{$pic}',n_addtime='{$addtime}',n_iscomm='{$iscomm}',n_ispic='{$ispic}',n_ishome='{$ishome}',n_keywords='{$keywords}',n_description='{$description}',a_outtime='{$outtime}' where n_id={$nid}" );
}
2. 94行
if ( $do == "add" )
{
$title = $content = $overview = $sorttit = $color = $author = $from = $pic = $sid = $nid = "";
$editor = $admin_name;
$addtime = $now = dtime( 0, 6 );
$iscomm = $ispic = $ishome = 0;
}
else
{
if ( $do == "edit" )
{
$nid = intval( $nid );
$rs = $db->get_one( "SELECT * FROM ".$cfg['tb_pre']."news where n_id={$nid}" );
if ( $rs )
{
$title = $rs['n_title'];
$content = stripslashes( $rs['n_content'] );
$overview = $rs['n_overview'];
$sorttit = $rs['n_sorttit'];
$color = $rs['n_color'];
$cid = $rs['n_cid'];
$sid = $rs['n_sid'];
$author = $rs['n_author'];
$editor = $rs['n_editor'];
$from = $rs['n_from'];
$pic = $rs['n_pic'];
$addtime = $rs['n_addtime'];
$iscomm = $rs['n_iscomm'];
$ispic = $rs['n_ispic'];
$ishome = $rs['n_ishome'];
$keywords = $rs['n_keywords'];
$description = $rs['n_description'];
$now = dtime( 0, 6 );
}
改成
if ( $do == "add" )
{
$title = $content = $overview = $sorttit = $color = $author = $from = $pic = $sid = $nid = "";
$editor = $admin_name;
$addtime = $now = dtime( 0, 6 );
$outtime = 0;
$iscomm = $ispic = $ishome = 0;
}
else
{
if ( $do == "edit" )
{
$nid = intval( $nid );
$rs = $db->get_one( "SELECT * FROM ".$cfg['tb_pre']."news where n_id={$nid}" );
if ( $rs )
{
$title = $rs['n_title'];
$content = stripslashes( $rs['n_content'] );
$overview = $rs['n_overview'];
$sorttit = $rs['n_sorttit'];
$color = $rs['n_color'];
$cid = $rs['n_cid'];
$sid = $rs['n_sid'];
$author = $rs['n_author'];
$editor = $rs['n_editor'];
$from = $rs['n_from'];
$pic = $rs['n_pic'];
$addtime = $rs['n_addtime'];
$iscomm = $rs['n_iscomm'];
$ispic = $rs['n_ispic'];
$ishome = $rs['n_ishome'];
$keywords = $rs['n_keywords'];
$description = $rs['n_description'];
$outtime = $rs['a_outtime'];
$now = dtime( 0, 6 );
}
修改部分为添加刚才的字段
三 :
admin/templets/info_main.htm 中找到 " 责任编辑:......<tr> " 167行
后面 加上一段:
<tr><td height="25" align="right">有效期:</td>
<td><input maxlength="10" size="5" name="outtime" value="<?php echo $outtime;?>" class="txt" />天</td></tr>
这三部完成后 覆盖原有文件 有效天数的功能就OK拉 ....
PS: 修改完了 总觉得还少了点什么 在嘉缘官方的帮助下解决了
数据功能是OK了 但是网站的前台显示还有问题 必须要加两条函数去控制
打开 inc/common.func.php
首页显示是 //函数:GetArticleList
列表 是//函数名:GetLastArticleList
两条函数下面分别加上一段就OK了
$sqlstr.=" and (DATEDIFF('".date('Y-m-d')."',n_addtime)<=a_outtime or a_outtime=0)";
|
|