Results 1 to 7 of 7

Thread: News script, how?

  1. #1

    Thread Starter
    Fanatic Member scr0p's Avatar
    Join Date
    Oct 2002
    Location
    VA
    Posts
    720

    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>';
    ?>
    asdf

  2. #2
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337
    you have to use a database of some kind to store the info.

  3. #3
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    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.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  4. #4

    Thread Starter
    Fanatic Member scr0p's Avatar
    Join Date
    Oct 2002
    Location
    VA
    Posts
    720
    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.
    asdf

  5. #5
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337
    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.

  6. #6
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    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.

  7. #7
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    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
  •  



Click Here to Expand Forum to Full Width