|
-
May 4th, 2003, 10:12 PM
#1
Thread Starter
Fanatic Member
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>';
?>
-
May 5th, 2003, 01:54 PM
#2
Frenzied Member
you have to use a database of some kind to store the info.
-
May 5th, 2003, 02:01 PM
#3
Stuck in the 80s
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.
-
May 5th, 2003, 09:28 PM
#4
Thread Starter
Fanatic Member
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.
-
May 5th, 2003, 10:06 PM
#5
Frenzied Member
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.
-
May 6th, 2003, 03:29 AM
#6
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.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
May 6th, 2003, 03:29 AM
#7
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.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|