943,544 Members | Top Members by Rank

Ad:
  • ASP Discussion Thread
  • Unsolved
  • Views: 740
  • ASP RSS
Jun 29th, 2009
0

Dynamically udate "News articles"

Expand Post »
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!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
redhotspike is offline Offline
21 posts
since Feb 2009
Jul 6th, 2009
0

Re: Dynamically udate "News articles"

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:
ASP Syntax (Toggle Plain Text)
  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
ASP Syntax (Toggle Plain Text)
  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
ASP Syntax (Toggle Plain Text)
  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.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
closetosane is offline Offline
12 posts
since Jan 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP Forum Timeline: blabla.com/content/blabla/
Next Thread in ASP Forum Timeline: User Authorization & Roles in ASP.Net while using MySQL





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC