Skip to main content
GameDev.net gamedev.net
🔒 Locked

Newsboxes

Started by AnonymousPosterChild Dec 4, 2002 at 2:32 PM 4 replies 400+ views
Original Post
AnonymousPosterChild
AnonymousPosterChild
You know how some sites have newsboxes on them showing the most recent news and they don''t have to constantly retype the entire thing in HTML whenever they want to update? Yeah. Anyone point me in the direction of a tutorial on that? Long separated by cruel fate, the star-crossed lovers raced across the grassy field toward each other like two freight trains, one having left York at 6:36 p.m. travelling at 55 mph, the other from Peterborough at 4:19p.m. at a speed of 35 mph.
With love, AnonymousPosterChild
DrunkenBastard
DrunkenBastard
I''m not sure what you mean. Do you mean like on gamedevs front page? I''ll almost guarantee you they don''t have to type any html to update their news.

------------------------------
p.s. excuse me english. im from L.A.
WayfarerX
WayfarerX
Seperate your model from your view so that it can be reused and the two can vary independently. GameDev does this by keeping their model in a database and using ASP templates as the view. A less coding-intensive solution would be to write your news data in an XML file and use XSLT to translate that into various html views.
"There is no reason good should not triumph at least as often as evil. The triumph of anything is a matter of organization. If there are such things as angels, I hope that they're organized along the lines of the mafia." -Kurt Vonnegut
AnonymousPosterChild
AnonymousPosterChild
Not nessecarily like the gamedev main page. I have limited knowledge in this, and all I know is that it involves the use of databases.

Long separated by cruel fate, the star-crossed lovers raced across the grassy field toward each other like two freight trains, one having left York at 6:36 p.m. travelling at 55 mph, the other from Peterborough at 4:19p.m. at a speed of 35 mph.
With love, AnonymousPosterChild
Michalson
Michalson
To do it the way most people do it (unless you want to make an app in C++ that generates a new html file to upload) you''ll need some form of active server page, like ASP or PHP, along with either a database (preferably) or a text file that can be parsed (this might require more effort).

For instance here is some of the source code from the Mini Contest page.

  
<SPAN CLASS=Heading>Recent News</SPAN> <SPAN CLASS=Menu><A HREF="News.asp">(View all news items)</A></SPAN>
<HR>
<%
const MaxNewsItemsToShow=3
Dim tblNews
OpenDatabase
Set tblNews = Server.CreateObject("ADODB.RecordSet")
tblNews.Open "SELECT TOP " & MaxNewsItemsToShow & " * FROM [News] ORDER BY [DatePosted] DESC", DataConnection
if tblNews.EOF then
Response.Write "<SPAN CLASS=Detail>There is no news!</SPAN>"
else
While not tblNews.EOF
Response.Write "<SPAN CLASS=Major>" & SQLTextOut(tblNews.Fields("Title")) & "</SPAN>"
Response.Write "<BR><SPAN CLASS=Minor>Posted " & tblNews.Fields("DatePosted") & "</SPAN>"
Response.Write "<BR><SPAN CLASS=Detail>" & SQLTextOut(tblNews.Fields("Body")) & "</SPAN>"
tblNews.MoveNext
if not tblNews.EOF then Response.Write "<BR><BR>"
Wend
end if
tblNews.Close
CloseDatabase
%>
AnonymousPosterChild
AnonymousPosterChild
figured it out. I just made some modifications to my forum stuff.

Long separated by cruel fate, the star-crossed lovers raced across the grassy field toward each other like two freight trains, one having left York at 6:36 p.m. travelling at 55 mph, the other from Peterborough at 4:19p.m. at a speed of 35 mph.
With love, AnonymousPosterChild

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.