新闻系统怎么写呀

sywj115447 2003-07-08 11:22:45
我想在自己的网站上写一个方便维护的新闻发布系统,请各路高手给指点一下:
1.我想知道新闻系统和留言板有什么不样的方?(留言板已经写好了)
2.请介绍一下新闻系统常用的关键模块;例如客户端显示、数据库、后台维护等。
3.能不能提供比较简单的范例,不要太复杂,我想先看看
因为这只是一个初步的想法,所以没有为大家准备太多分(没办法,分不多了呀);在我正式写的时候就不一样了,会不断出现各种问题的,请大家到那时再支持我吧!可是有高分的喔!!!!!
...全文
36 28 打赏 收藏 转发到动态 举报
写回复
用AI写文章
28 条回复
切换为时间正序
请发表友善的回复…
发表回复
楚人无衣 2003-08-11
  • 打赏
  • 举报
回复
<form method="post" action="adnews.asp" name="editnews">
<tr>
<td align=middle width=483 height="25">
<div align="center"><font color="#000080" size="2">新闻编辑</font></div>
</td>
</tr>
<tr>
<td align=middle>
<table width=100% border=0 cellspacing=0 cellpadding=3>
<tr>
<td width=50 class=link>
<div align="right">主题: </div>
</td>
<td width=413>
<input type=text name="etitle" size=60 maxlength=60 value="<%=rs("title")%>"onMouseOver = "this.style.backgroundColor = '#E5F0FF'" onMouseOut = "this.style.backgroundColor = ''">
</td>
</tr>
<tr>
<td width=50 class=link valign="top">
<div align="right">内容: </div>
</td>
<td width=413 valign="top">
<textarea name="emessage" cols="62" class="link" rows="20" onMouseOut = "this.style.backgroundColor = ''" onMouseOver="this.style.backgroundColor = '#E5F0FF'"><%=message%></textarea>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align=middle width=483>
<div align="center">
<input type="submit" value="确 定" name="editnews" style="background-color: #99CCFF; color: #000080; border-style: solid; border-width: 0">
<input type="reset" value="还 原" name="reset" style="background-color: #99CCFF; color: #000080; border-style: solid; border-width: 0">
</div>
</td>
</tr>
<tr>
<td align=middle width=483>
<div align="left"></div>
</td>
</tr>
</form>
</table>
<script language="vbscript">
sub window_onload()
editnews.etitle.focus
end sub
</script>

<%
set rs=nothing
end if
%>
<table border="0" cellspacing="1" cellpadding="0" width="87%">
<tr>
<td width="100%" background="images/tbg1.gif" align="right">
<select size="1" name="tt" onChange="location.href=this.options[this.selectedIndex].value">
<option>跳转</option>
<%
tp=0
do while not tp=pc-1
%>
<option value="adnews.asp?page=<%=tp+1%>"><%=tp+1%></option>
<%
tp=tp+1
loop
%>
</select>
<%
if page<>1 then
response.write "[<a href='adnews.asp?page=1'>首页</a>] "
response.write "[<a href='adnews.asp?page="&(page-1)&"'>上一页</a>] "
end if
if page<>pc then
response.write "[<a href='adnews.asp?page="&(page+1)&"'>下一页</a>] "
response.write "[<a href='adnews.asp?page="&pc&"'>尾页</a>] "
end if
%>
</td>
</tr>
</table>

<br>
<div align="center">程序制作:<a href="http://www.wlxm.com" target="_blank">网龙网络</a></div>

</body>
<%set conn=nothing%>

</html>
楚人无衣 2003-08-11
  • 打赏
  • 举报
回复
if request("add")="yes" then
session("add")=true
%>
<table border=1 cellpadding=5 cellspacing=0 width="550" align="center" bordercolor="#000080" style="border-collapse: collapse">
<form method="post" action="adnews.asp" name="addnews">
<tr>
<td align=middle width=483 height="25">
<div align="center"><font color="#000080" size="2">新闻添加</font></div>
</td>
</tr>
<tr>
<td align=middle>
<table width="504">
<tr>
<td width=40 class=link>
<div align="right">主题: </div>
</td>
<td width=450>
<input type="text" name="title" size="60" onMouseOut = "this.style.backgroundColor = ''" onMouseOver="this.style.backgroundColor = '#E5F0FF'">
</td>
</tr>
<tr>
<td width=40 class=link valign="top">
<div align="right">内容: </div>
</td>
<td width=450 valign="top">
<textarea name="message" cols="62" class="link" rows="20" onMouseOut = "this.style.backgroundColor = ''" onMouseOver="this.style.backgroundColor = '#E5F0FF'"></textarea>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align=middle width=483>
<div align="center">
<input type="submit" value="提 交" name="turnin" style="background-color: #99CCFF; color: #000080; border-style: solid; border-width: 0">
<input type="reset" value="重 置" name="reset" style="background-color: #99CCFF; color: #000080; border-style: solid; border-width: 0">
</div>
</td>
</tr>
<tr>
<td align=middle width=483></td>
</tr>
</form>
</table>
<script language="vbscript">
sub window_onload()
addnews.title.focus
end sub
</script>

<%
end if

if request("edit")<>"" then
session("eid")=request("edit")
set rs=conn.execute("select * from news where id="&request("edit")&"")
message=rs("msg")
message=replace(message,"''","'")
message=replace(message," "," ")
message=replace(message,"<br>",vbcrlf)
%>
<table border=1 cellpadding=5 cellspacing=0 width="550" align="center" style="border-collapse: collapse" bordercolor="#000080">
楚人无衣 2003-08-11
  • 打赏
  • 举报
回复
给你代码……
1.后台管理
<!-- #include file="conn.asp" -->
<%
if session("adpass")<>"passed" then response.redirect "index.htm"
response.cachecontrol="no-cache"
%>

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<link rel="stylesheet" type="text/css" href="../style.css">
<title>新闻管理</title>

<base target="_self">

</head>

<%
if request("turnin")="提 交" and request("title")<>""and session("add")=true then
title=server.htmlencode(request("title"))
message=server.htmlencode(request("message"))
message=replace(message,vbcrlf,"<br>")
message=replace(message," "," ")
message=replace(message,"'","''")
conn.execute("insert into news(title,msg) values('"&title&"','"&message&"')")
session("add")=false
end if

if request("editnews")="确 定" and request("etitle")<>"" then
etitle=server.htmlencode(request("etitle"))
emessage=server.htmlencode(request("emessage"))
emessage=replace(emessage,vbcrlf,"<br>")
emessage=replace(emessage," "," ")
emessage=replace(emessage,"'","''")
if emessage<>"" then
conn.execute("update news set title='"&etitle&"',msg='"&emessage&"',mt=now() where id="&session("eid")&"")
else
conn.execute("update news set title='"&etitle&"',mt=now() where id="&session("eid")&"")
end if
end if

if request("del")<>"" then
conn.execute("delete from news where id="&request("del")&"")
end if
%>

<script language="javascript">
<!--
function winopen(url)
{
window.open(url,"显示新闻","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=550,height=300,top=100,left=125");
}
//-->
</script>

<body background="images/bg.gif">
<p align="center"><font class="3dfont0" face="楷体_GB2312" size="5" color="#000080">新闻管理页面</font>
<br>
<%
if request("add")="" and request("edit")="" then
set rs=server.createobject("adodb.recordset")
sql = "select * from news order by mt desc"
rs.open sql,conn,3

mypage=request("page")
if not isnumeric(mypage) or mypage="" then mypage=1
rs.pagesize=12
page=clng(mypage)

if page<1 then page=1
if page>rs.pagecount then page=rs.pagecount
rs.absolutepage=page
pc=rs.pagecount
%>
<table border=0 cellpadding=0 cellspacing=0 width="600" align="center" style="border-collapse: collapse">
<tr>
<td width="100%" background="images/tbg0.GIF">
<p align=right><img src="images/page.gif">页数:<%=page%>/<%=rs.pagecount%>   
<img src="images/nc.gif"> 新闻数: <%=rs.recordcount%>
<a href="adnews.asp?add=yes">添加新闻</a>  
</td>
</tr>
</table>
<table border=0 cellpadding=3 cellspacing=1 width=600 align="center" height="1">
<tr bgColor="#ECF7FF" align="center" class="td1">
<td height=1 width=26 align="left" background="images/tbg1.gif">序号</td>
<td height=1 width=249 align="left" background="images/tbg1.gif">主 题</td>
<td height=1 width=32 align="left" background="images/tbg1.gif">点击</td>
<td height=1 width=176 align="left" background="images/tbg1.gif">更新时间</td>
<td height=1 width=46 align="left" background="images/tbg1.gif">编辑</td>
<td height=1 width=46 align="left" background="images/tbg1.gif">删除</td>
</tr>
<%for i=0 to rs.pagesize%>
<tr bgColor="#ECF7FF" onmouseover="this.bgColor=''" onmouseout="this.bgColor='#ECF7FF'">
<td height='7' width="26"><%=i+1%></td>
<td height='7' width="249"><a href=javascript:winopen('../read.asp?id=<%=rs("id")%>')><%=rs("title")%></a></td>
<td height='7' width="32"><%=rs("click")%></td>
<td height='7' width="176"><%=rs("mt")%></td>
<td height='7' width="46"><a href="adnews.asp?edit=<%=rs("id")%>">编辑</a></td>
<td height='7' width="46"><a href="adnews.asp?del=<%=rs("id")%>" onclick="return confirm('真的要删除么?')">删除</a></td>
</tr>
<%
rs.movenext
if rs.eof then exit for
next
%>
<tr background="images/tbg.gif">
<td align='left' width="575" colspan="6" background="images/tbg.gif"> </td>
</tr>
</table>
<br>
<center>
<%
set rs=nothing
end if

sywj115447 2003-08-11
  • 打赏
  • 举报
回复
你那个我看了,还不错(你那上面怎么有那么大段的新闻啊),是我想要的,那你能不能把后台的也告诉我呀^_^
我想看看!服务器端的要怎么写啊
zhangking 2003-08-08
  • 打赏
  • 举报
回复
http://www.aircity.gov.cn/xwzx/xwzx.asp
--- 是我写的. 支持图片、滚动新闻等。
zhangking 2003-08-08
  • 打赏
  • 举报
回复
http://www.why100000.com/others/news_publish/login.htm
sywj115447 2003-08-08
  • 打赏
  • 举报
回复
喔,也就是说,我必须自己把路径写入数据库,是这样吗?
bineon 2003-08-08
  • 打赏
  • 举报
回复
建立数据库,设置相应字段保存相关信息,比如writer字段保留作者等,一般应该有作者、时间、内容。标题、点击等。当然还有唯一标识id
然后显示文章的页面未list.asp
在这个asp文件里面我们读取数据库里面的id,title,等显示出来,然后吧title做链接,链接到view.asp?id=<%=rs("id")%>,这样点击文章标题的时候就可以打开view.asp页面了!
在view里面你读取id为request(“id”)的记录,然后在模板里面显示出了就可以了!
sywj115447 2003-08-08
  • 打赏
  • 举报
回复
我说过了,那种纯粹依靠asp实现页面的功能,我暂时不想采用(还没有需要图文混排的地方);
我只想要新闻标题 自动生成 超链接,就行了,页面还是自已做算了,反正有模板嘛!!!
ShaB 2003-08-08
  • 打赏
  • 举报
回复
分类上比较讲究吧,至于图文混排的,ASP输出一个不太美观的图文页面,应该也不难。
sywj115447 2003-08-08
  • 打赏
  • 举报
回复
大家再多给点意见呀!!!!
sywj115447 2003-07-18
  • 打赏
  • 举报
回复
原来这样啊!
wggipkhgef 2003-07-11
  • 打赏
  • 举报
回复
如果只是给新闻标题编一个系统的话,可以给新闻标题定义一个字段,这样通过操作数据库很容易实行、

不行新闻系统的实时性比较强,不是很容易!
sywj115447 2003-07-11
  • 打赏
  • 举报
回复
喔,喔,我在网上下了两个,不过好像都挺大的,现在正在学习中;
要是大家有容易看懂的,请发邮件至:sywj115447@163.com(另:我只是喜欢樱木花道而已,要是真的去学他,可就不好玩了)
cdsun 2003-07-10
  • 打赏
  • 举报
回复
你放出来下载阿
6048378 2003-07-10
  • 打赏
  • 举报
回复
我也做过新闻在线更新系统,还可以上传产品图片,图片并排等,不过因为它包含自定义的类,比较大,如果想要的话,给我发邮件吧
w6048378@tom.com
liujnfn 2003-07-09
  • 打赏
  • 举报
回复
你不是天才吗?
Struggling 2003-07-09
  • 打赏
  • 举报
回复
最近编写了一个新闻发布系统(是大学里面用的),并不是很难,不过要考虑很多问题。
lishiqian 2003-07-09
  • 打赏
  • 举报
回复
好像要用到DHTML,问问DHTML高手。
sywj115447 2003-07-09
  • 打赏
  • 举报
回复
高手,高手快进来!
加载更多回复(8)

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧