Dynamically udate "News articles"

Reply

Join Date: Feb 2009
Posts: 21
Reputation: redhotspike is an unknown quantity at this point 
Solved Threads: 0
redhotspike's Avatar
redhotspike redhotspike is offline Offline
Newbie Poster

Dynamically udate "News articles"

 
0
  #1
Jun 29th, 2009
Ok - I have never used ASP before. I'm pretty hardcore with (x)HTML, JavaScript, CSS, and I also know C++.
Here's the thing - I need to create some sort of code that receives information from the back end of a site and dynamically adds a link on an overview page of that new article and also creates a new webpage with the article on it.
I'm not quite sure where to start or how to go about doing this. If anyone could give me a push in how to get started or maybe explain how the code would work?
**The link will reside on a page built with HTML**
Any help is greatly appreciated....
If necessary I'll use PHP (but I don't have any experience with that either )
Thanks!
Imagine if every Thursday your shoes exploded if you tied them the usual way. This happens to us all the time with computers, and nobody thinks of complaining.
~Jef Raskin
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 12
Reputation: closetosane is an unknown quantity at this point 
Solved Threads: 1
closetosane closetosane is offline Offline
Newbie Poster

Re: Dynamically udate "News articles"

 
0
  #2
Jul 6th, 2009
With your overview page have a sql statement that creates the links. To do this have one of your columns in the database table reference the title of the article. Then when calling the title also request the primary key from the database for that article.

Create a do until end of record set and populate the page with anchors created from this data:
  1. [Inside table]
  2. Do Until objRS.EOF
  3. Response.Write "<td><a href ='ShowArtical.asp?Artical="&rs(“Article_ID”)&" '>”&objRS(“article_Name”)&”</a></td>"
  4. objRS.Move.Next
  5. Loop
  6. [Inside table]
If you want to get fancy you can add another row under the link to show the first part of the article and use CSS to make the link to the article the same colour text as the rest of your page.

In the page I called ShowArtical.asp you will need to grab the Article_ID from the query string
  1. Article_ID = Request.QueryString("Article_ID ")
Create another SQL statement where your ID column equals the Article_ID variable

SELECT A_Title, A_Body, A_ID
FROM Article
WHERE A_ID = Article_ID

Open your database and create a record set.

Place the data from the record set how you want it formatted within the page
  1. [Inside table]
  2. Response.Write "<tr>"
  3. Response.Write "<td>” & objRS(“A_Title”) & “</td>"
  4. Response.Write "<tr>"
  5. Response.Write "<td >” & objRS(“A_Body”) & “</td>"
  6. Response.Write "<tr>"
  7. [Inside table]
If I understood your question correctly that’s about it. ShowArtical.asp will be used for all the articles. You may also want to put a date column in the database so you can query only articles written within a certain timeframe. You may also want a page that has a text box for the title and body of a new article to insert into the database.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC