|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Creating Page Breaks
Here's my question! I'm wanting to display articles on my site dynamically using ASP/Access. (Actually I'm using Dreamweaver MX).
I would like to be able to split the longer articles into different pages and then have a table of contents similiar to what DevArticles does. Can anybody point me in the right direction so that I can do this? I have ideas on how to do this but there has to be easier ways. Thanks |
|
#2
|
|||
|
|||
|
Articles and Pages
To lynnit:
Currently, I am working on a content management system with similar capibilities and am developing with ASP.NET and Microsoft SQL Server. Using said RDMS, here are the three table build scripts which you might need: IF EXISTS ( SELECT * FROM dbo.SysObjects WHERE ID = object_id(N'[dbo].[Articles]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1) DROP TABLE [dbo].[Articles] GO CREATE TABLE [dbo].[Articles] ( [ArticleID] [int] IDENTITY (1, 1) NOT NULL, [Description] [ntext] NOT NULL, [Name] [nvarchar] (255) NOT NULL, [Published] [bit] NOT NULL DEFAULT '1', [Timestamp] [datetime] NOT NULL DEFAULT GETDATE(), [UserID] [int] NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO IF EXISTS ( SELECT * FROM dbo.SysObjects WHERE ID = object_id(N'[dbo].[Pages]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1) DROP TABLE [dbo].[Pages] GO CREATE TABLE [dbo].[Pages] ( [PageID] [int] IDENTITY (1, 1) NOT NULL, [Content] [ntext] NOT NULL, [Name] [varchar] (255) NOT NULL, [Number] [int] NOT NULL, [Timestamp] [datetime] NOT NULL DEFAULT GETDATE(), [ArticleID] [int] NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO IF EXISTS ( SELECT * FROM dbo.SysObjects WHERE ID = object_id(N'[dbo].[Users]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1) DROP TABLE [dbo].[Users] GO CREATE TABLE [dbo].[Users] ( [UserID] [int] IDENTITY (1, 1) NOT NULL, [Email] [nvarchar] (255), [Enabled] [bit] NOT NULL DEFAULT '1', [FirstName] [nvarchar] (255), [MiddleName] [nvarchar] (255), [LastName] [nvarchar] (255), [Password] [nvarchar] (255), [Timestamp] [datetime] NOT NULL DEFAULT GETDATE(), [UserName] [nvarchar] (255) NOT NULL ) ON [PRIMARY] GO ALTER TABLE [dbo].[Articles] WITH NOCHECK ADD CONSTRAINT [PK_Articles] PRIMARY KEY NONCLUSTERED ( [ArticleID] ) ON [PRIMARY] GO ALTER TABLE [dbo].[Pages] WITH NOCHECK ADD CONSTRAINT [PK_Pages] PRIMARY KEY NONCLUSTERED ( [PageID] ) ON [PRIMARY] GO ALTER TABLE [dbo].[Users] WITH NOCHECK ADD CONSTRAINT [PK_Users] PRIMARY KEY NONCLUSTERED ( [UserID] ) ON [PRIMARY] GO ALTER TABLE [dbo].[Articles] WITH NOCHECK ADD CONSTRAINT [FK_Articles_Users] FOREIGN KEY ( [UserID] ) REFERENCES [dbo].[Users] ( [UserID] ) ON DELETE CASCADE NOT FOR REPLICATION GO ALTER TABLE [dbo].[Pages] WITH NOCHECK ADD CONSTRAINT [FK_Pages_Articles] FOREIGN KEY ( [ArticleID] ) REFERENCES [dbo].[Users] ( [ArticleID] ) ON DELETE CASCADE NOT FOR REPLICATION GO From a UI perspective, I'd imagine that you'd want to create a front-end to the Users table where one could add, edit or delete users. Thereafter, you'll create an Articles front-end where users can add, edit or delete articles. Once an article is created, a link would be available next to that article labeled "Pages." Clicking on that link would take the user to another front-end where he/she could add, edit, delete or change the order of pages associated with that particular article. When you go to display the documents to the end-user, then you would first execute the following SELECT statement to return all of the availabe articles: SELECT Articles.Description, Articles.Name, Articles.Timestamp, Users.UserName FROM Articles, Users WHERE Articles.Published = 1 Then, when the user clicks on a specific article, you would execute the following SELECT statement to return that particular article's pages: SELECT Articles.Name, Articles.Timestamp, Pages.Name, Pages.Number, Users.UserName FROM Articles, Pages, Users WHERE Articles.ArticleID = [Requested article's ID] You could then create an ordered/unordered list of the pages from this data for your Table of Contents and force the user to click on the link for a particular page. Thereafter, you'd execute the following SQL statement to return the proper page's content: SELECT Articles.Name, Articles.Timestamp, Pages.Content, Pages.Name, Pages.Number, Users.UserName FROM Articles, Pages, Users WHERE Articles.ArticleID = [Requested article's ID] AND Pages.PageID = [Requested page's ID] And then you'd display the HTML. I hope this helps. If you have any questions, then please feel free to send them my way. Thanks and have a good one! |
|
#3
|
|||
|
|||
|
Thank You! That was very helpful
![]() |
|
#4
|
|||
|
|||
|
No problem; anytime! Please feel free to contact me with any further questions. Have a good one.
|
|
#5
|
|||
|
|||
|
You might want to read this thread as well, where James sets out the underlying database structure.
http://www.devarticles.com/forum/sh...s=&threadid=860 |
![]() |
| Viewing: Dev Articles Community Forums > Programming > ASP Development > Creating Page Breaks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|