Free: Using Advanced HTML Editor to Create a Content Management System Support
In this free, 20 page tutorial, Matt Machell shows you how to use Dreamweaver server behaviours and the DMXzone Advanced HTML Editor extension to build a password-protected Content Management Solution for a web site, that allows normal users to read news or text or whatever you choose to put on your site, while users with the correct password can add or amend the text using an intuitive word processor-like administration system - so your clients can maintain their own web sites without having to know HTML and without risking breaking the look and feel of the site!
Because Matt's using the extension and built-in server behaviours, there's no handcoding involved, so matt shows you how to use it using both ASP and PHP.
Setting up the Database
Now we have our files, it's time to ready our database. We're going to use two database tables for this application: cms_news and cms_users.
cms_news contains each of our news items.
Column |
Type |
Features |
id |
bigint |
Primary key, identifier |
news_item |
vchar(1000) |
|
news_date |
datetime |
Default of getdate() |
news_live |
vchar(1) |
Default value of 'n' |
Each column stores a piece of information about our news item. Id is a unique number so we know which new item is which. news_item is the actual text of the item. news_date is the date it was added. news_live is a simple Y/N option to indicate if a news item is live to our site, or hidden from public view – maybe it's not fully updated yet.
cms_users is used to check if a user is valid when they log into the admin system
Column |
Type |
Features |
id |
bigint |
Primary Key, identfier |
cms_user |
vchar(20) |
|
cms_pass |
vchar(20) |
Create the tables using your favored tool (Some prefer the Enterprise Manager tool that comes with the paid-for editions of SQL Server, but many hosting packages come with an online tool you can use). If you're using Enterprise Manager, you should get a window like the one below:
If you highlight the SQL Server Group icon and right click, the option to add a New SQL Server Registration will be available. Using the wizard provided, fill in your SQL server details and it will appear underneath the SQL Server Group tree. Click on the databases folder and access your database (or create it if you haven't yet).
Right click on the tables icon, and select New Table. The new table dialog will open:
Fill the information in as provided in the tables above and then right click and choose the save option. Close the window.
I also added some test data; you can do this by right clicking on a table, choosing Open Table > Return All Rows, and then adding a new row. Alternatively you can use the Query Analyser tool to execute some SQL like that below:
INSERT INTO cms_news (news_item, news_live)
VALUES ('A test item news item', 'y')
This inserts a new news item. Note that we only provided the news_item and news_live values, since the date is set automatically with the getdate() function. Similarly we can add a new user with the following SQL:
INSERT INTO cms_users (cms_user, cms_pass)
VALUES ('admin', '6868')
Which inserts a new user called admin with a password of 6868.
We'll use this data to make sure everything is working testing the application.
Matt Machell
A man of many talents, Matt has been a web designer, technical editor, and jewellery picker. He is currently on contract for the Birmingham City University, producing pages for research centres.
He has tech-edited a dozen books on web design and development for glasshaus, Apress and Sitepoint.
He likes music with loud guitars and games with obscure rules.
His website can be found at: http://www.eclecticdreams.com
He lives in Birmingham with his girlfriend, Frances, and a horde of spider plants.