用Dreamweaver MX+ACCESS制作企业新闻系统
如果在程序中,看到有错误的地方,请到我站点提出(http://www.rushanren.com),我将马上修改! 在开发动态网站的时候,总是发现很多朋友问我要新闻系统,我总是给他们指出到这down到那down,但是很快他们就不满意的回来Q我了,告诉这个太大,那个太大,这个不会改,
如果在程序中,看到有错误的地方,请到我站点提出(http://www.rushanren.com),我将马上修改!
在开发动态网站的时候,总是发现很多朋友问我要新闻系统,我总是给他们指出到这down到那down,但是很快他们就不满意的回来Q我了,告诉这个太大,那个太大,这个不会改,那个也不会改.在这里,我写这篇DWMX+access开发动态新闻教程,就是为了帮助那些朋友,授人以鱼总是不如授人以渔嘛!
不废话了,进入正题:
首先给大家看看这个新闻界面:
后台管理页面:
为了方便在这里给大家直观目录:
具有的功能为:
1.带后台管理员功能;
2.每条新闻具有发布时间和浏览次数;
3.能输入HTML代码,解决英文自动换行功能;
4.后台具有删除,编辑功能;
5.尽量精简代码,书写规范简单明了;
不足的地方:
1.由于时间关系和对初学者的考虑我没有做分页功能,如果大家想学习,我会在下次教程写出来!
2.没有写出首页调用代码,也是为初学者考虑
3.对后台添加新闻表单没有验证
开发工具:
DreamweaverMX和Access2000
好了,大家准备好了吧,我相信如果大家仔细看教程大约5小时就可以明白整个开发原理,很简单的:
先给大家说说开发步骤(或许不太规范,是按照本人习惯)
1.规划定义站点,建立各个功能模块文件。
好了,咱们开始吧,一个好的站点,应该先规划好站点文件的存放!
好了先看看文件目录:
下面解释一下:
目录:admin(用于存放后台管理程序文件)
文件:
xh_add.asp (后台管理页面)
xh_edit.asp (后台编辑页面)
xh_del.asp (后台删除页面)
xh_login.asp (后台管理登陆页面)
xh_cklogin.asp (后台管理验证页面)
xh_loginout.asp (后台管理退出页面)
xh_write.asp (新闻添加页面)
xh_save.asp (添加新闻验证页面)
xh_conn.asp (数据库连接文件)
目录:date (存放数据库文件)
目录:images (存放图片)
主目录下文件:
index.asp (新闻首页面)
conn.asp (数据库连接文件)
xh_look.asp (新闻查看页面)
xh_wei.asp (include连接结尾页面)
好了具体的规划就是这些,大家应该能明白一个步骤了吧!
也是一个思考过程,建站--建立各功能目录--建立数据库--建立后台文件--建立显示记录页面---完善程序例如编辑删除功能
2.用Access写数据库xhnew.mdb
这次咱们就来做这个新闻系统的数据库,放心很简单,几分钟就可以搞定!
首先开发ACCESS,设计表,如下图:
在这里,我详细介绍一下各个数据类型的功能
name用来存放新闻发布者的姓名(文本)
content 用来存放新闻内容(切记设置为备注,因为储存量多)
title 新闻标题(文本)
xhcount 存放每条记录点击数(数字型)
xhtime 每条新闻发布时间(时间类型)
在此在说明一下conn.asp文件,就是数据库连接文件
大家能看明白嘛?第一句声明DB为数据名。
然后打开ADO,这个是规范写法,对于数据库移动位置可以在server.mappath改。
3.写后台管理登陆页面xh_login.asp和xh_cklogin.asp还有退出管理页面xh_loginout.asp
这次,准备讲解这个后台登陆的几个页面!
xh_login.asp这个页面主要一个表单递交页面,递交到xh_cklogin.asp
xh_cklogin.asp是个验证表单密码的页面。
好了,咱们来分析这段代码。
<br>name=trim(request.Form("username"))<br>pass=trim(request.form("password")) <br>
主要是从login.asp提取2个表单的值
<br>if name="" or pass="" then<br>response.write "" <br>end if<br>
主要就是验证输入的用户名和密码是否是空值,这个参数是从登陆框传递过来的!记得我们给xh_login.asp的各个控件赋予了名称
<br>if name="adminxh" and pass="adminxh" then<br>session("xianhe")="yes"<br>response.redirect "xh_add.asp"<br>else<br>response.write ""<br>end if<br>
主要就是验证密码是否正确了,如果正确进入下个页面,不正确返回登陆页面!在这里主要要提的是,这么一句代码。
<br>session("xianhe")="yes"<br>
这句代码非常的重要,就是这个会话可以防止别人非法登陆你的后台页面,在下节在着重讲解,在这里你只要明白,我把这个会话赋值为"yes"
xh_loginout.asp是个退出管理的跳转页面,只有2行代码
第一行是消除会话的值
第二行是跳转页面代码
[1] [2]

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Adjusting the text position in Dreamweaver can be completed by the following steps: Select the text and use the text position adjuster to make horizontal adjustments: left alignment, right alignment, center alignment; 2. Make vertical adjustments: top alignment, bottom alignment, vertical center; 3. Press Shift key and use the arrow keys to fine-tune the position; 4. Use shortcut keys to quickly align: left alignment (Ctrl/Cmd + L), right alignment (Ctrl/Cmd + R), center alignment (Ctrl/Cmd + C).

Embed video using Dreamweaver: Insert a video element. Select and upload a video file. Set video type, URL, size, autoplay and controls. Insert video. Optional: Customize the video appearance.

Adjusting line spacing in Dreamweaver is a four-step process: select the text, open the Paragraph panel, adjust the Line Spacing options, and finally click OK to apply the changes.

To insert a picture in Dreamweaver, click the Insert menu and choose Image, then navigate to the picture file and select it. Other methods include dragging and dropping files or inserting HTML code directly. Adjusting properties includes changing size, alignment, adding borders, and entering alt text.

You can set fonts in Dreamweaver by selecting a font, size, and color using the Properties panel. Use CSS to set fonts for your entire website or specific elements. Set the font directly in the HTML code using the "font" tag.

To set Dreamweaver to Chinese, follow these steps: Open Dreamweaver; change User Interface Language to Simplified Chinese or Traditional Chinese in the preferences; restart Dreamweaver; check the Help menu About Dreamweaver" item to verify the language settings.

Add a text box in Dreamweaver: Open a new document and insert a table text field. Set text box properties, including name, height, width, and wrapping, through the Properties panel. Double-click the text box to enter text and use the text editing function to set the text style. Customize the appearance and behavior of text boxes with CSS. Use the HTML tab of the Properties panel to view and edit the text box code.

To set text size in Dreamweaver, just: Select the text Go to the Text menu Select Font Size Select the desired size Press Enter to save
