-
News script, how?
I want to make a news script, simple, it just gets the news, and username and add's it, right now it works fine but I have to feed it the info, how do I make it so the admin can update it without touching the php/html files? (updating by logging in and filling out forms).. this is what I have so far:
on the main page, it has include('news.php'); and news.php is here
Code:
<?php
//The new content will normally be sent from the user.
$NewContent = <<<NC
<pre>
Yo I'm getting way too good with PHP
son, If I make **** it actually wErks now.
I'll try to like, make a **** to add news
dynamically, without editing files, still
working on how the format of the news will
be.. also need to get soMe things fixed up.
</pre>
NC;
$nick = 'scr0p';
$name = "<a href=\"mailto:[email protected]\">$nick</a>";
$date1 = date ("l F Y h:i A");
$table_head = <<<TH
<tr>
<td width="352" height="11"><font size="2" face="Fixedsys">Posted by: $name on $date1
</font>
</tr>
<tr>
<td width="352" height="139" valign="top" bgcolor="#E6E6E6">
TH;
$table_tail = <<<TT
</tr>
TT;
//Ok ok, we got all the info we need to add the news, now lets add it-_-
print '<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="352" height="154">';
print $table_head;
print $NewContent; //This will be what the user puts..
print $table_tail;
print '</table>';
?>
-
you have to use a database of some kind to store the info.
-
I'm working on a news management system right now and it should be done fairly soon. If you have any specific questions, feel free to ask.
But as phpman said, you're going to need some kind of database and submission script, which is probably going to need authentication of some sort, which may involve another table in the database. :)
-
I know, I will eventually use MySQL. But for now, this is only local and there is nothing I am hiding so I dont need authentication. I am using a textfile to store the info. but how do I edit the news from 1 page and read it from another?.. like update.php will have a form, you fill in your nick, news topic, news body and then submit and it sends it to "news.php".. I would guess that update.php writes to a file and then news.php reads from the file, but now sure how to do it with text files.. unless each news entry is only 1 line.
-
again they use a database. it doesn't have to be mysql, a flat file is also a database. and mysql isn't just for authentication, it stores info as well.
-
You have a html page with the form. The page submits to receive.php (or whatever) which places the info in the long-time-storage. news.php (the display file) simply reads the storage.
-
Another way would be making receive.php editing an XML file and the news page simply be the xml formatted with XSLT, but that requires an XSLT-compatible browser.