Web Design Forum  
 
Go Back   Web Design Forum > Web Software > Scripts

Reply
 
LinkBack Thread Tools Display Modes
Old 03-30-2006, 10:17 AM   #1 (permalink)
New Member
 
Join Date: Mar 2006
Posts: 1
Default News Posting Script

Hi Guys, pretty simple question....Anyone know of a news posting script where I can post news on the front page of my website rather than editting the html everytime?

Thanks,
Tim.
TKCDesigns is offline   Reply With Quote
Old 04-03-2006, 02:40 PM   #2 (permalink)
Bronze Member
 
thrive's Avatar
 
Join Date: Mar 2006
Location: Ottawa, Canada
Posts: 66
Send a message via MSN to thrive
Default

What languages can you use? The easiest way is to dynamically write to a text file and have the home page read from it. People will suggest using a database but if it's only one file then you don't need to do that.
thrive is offline   Reply With Quote
Old 04-03-2006, 03:11 PM   #3 (permalink)
New Member
 
toxic_pmp's Avatar
 
Join Date: Feb 2006
Posts: 19
Default

if its in php/mysql then i would you a database!
Quote:

Use this for the front page where you want it selected

<?php
$usel = mysql_query("select * from news order by id desc limit 10");
while ($upd = mysql_fetch_array($usel)) {
print "<b>$upd[title]</b> by <b>$upd[starter]</b>... \"$upd[news]\"<br><br>";
}

?>


then to put the information into the database use this bit of script ona new page,


<table>
<form method=post action=addnews.php?action=add>
<tr><td>Starter:<td><td><input type=text name=addstarter></td></tr>
<tr><td>Title:</td><td><input type=text name=addtitle></td></tr>
<tr><td valign=top>Update:</td><td><textarea name=addnews rows=5 cols=19></textarea></td></tr>
<tr><td colspan=2 align=center><input type=submit value="Add News"></td></tr>
</form>
</table>

<?php
if ($action == add) {
if (empty ($addtitle) || empty ($addnews)) {
print "You are going to need to fill all fields out to be able to add the news item";
exit;
}
mysql_query("insert into news (starter, title, news) values('$addstarter','$addtitle','$addnews')") or die("Could not add news.");
print "news added was added $addstarter";
}

?>


here is the sql for it


CREATE TABLE `news` (
`id` int(11) NOT NULL auto_increment,
`starter` text NOT NULL,
`title` text NOT NULL,
`news` text NOT NULL,
UNIQUE KEY `id` (`id`)
) TYPE=MyISAM AUTO_INCREMENT=1 ;
If you need any help just give me a msg i will reply within 24 hours as im on here everyday playing around!
__________________
Webmaster
toxic_pmp is offline   Reply With Quote
Old 04-03-2006, 03:21 PM   #4 (permalink)
Bronze Member
 
thrive's Avatar
 
Join Date: Mar 2006
Location: Ottawa, Canada
Posts: 66
Send a message via MSN to thrive
Default

Why would you use a database when it's just a blurb on the homepage? (Note the last comment I made). If you want to maintain server efficiency you wouldn't do this. Having each hit to the page openning a connection to the database, reading from it, closing it, and posting the results is far to complicated for something like this.
thrive is offline   Reply With Quote
Old 04-04-2006, 12:16 PM   #5 (permalink)
New Member
 
toxic_pmp's Avatar
 
Join Date: Feb 2006
Posts: 19
Default

no its actually very simple!!! and a good way!!! then u dnt need to go into your host administator login!!! all you need to do is go to a certain page and just simply add the update!!!
__________________
Webmaster

Last edited by toxic_pmp; 04-05-2006 at 11:18 AM.
toxic_pmp is offline   Reply With Quote
Old 04-04-2006, 01:01 PM   #6 (permalink)
Bronze Member
 
thrive's Avatar
 
Join Date: Mar 2006
Location: Ottawa, Canada
Posts: 66
Send a message via MSN to thrive
Default

Using a text file or a database would both require you go to a secure page and apply an update. What I'm talking about is the thousands of database connections required each day if your visitors hit it. Using a text file or a xml file would eliminate this need for a connection, thus making the application much more efficient.
thrive is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 10:22 AM.


Computer Forum - Internet Business - Webpage Design

 
Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.