Jump to content

Help with an update system


Recommended Posts

I'm making an update system where the site admin writes a new update to a file in the archives which contain only the HTML of the update, not the whole page. Then what I want to happen is for the main index.php file to display the latest 5 updates from the archive directory. I'm not sure how to make that happen. Any and all help in this area would be very much appreciated.

Link to comment
Share on other sites

Just create a table called "updates" with these fields:

 

updateID

poster (person who posted update)

date_posted (date of post, if you wante that)

body (The update itself)

 

Then just make a form, and when they press submit, add the information to the database. Then wherever you want them displayed, all you have to do is pull that information from the database.

 

Link to comment
Share on other sites

  • 2 weeks later...

So you have separate HTML pages for each update? What exactly are the updates? I would use a database for most anything. You can use a text file if you don't have SQL access, but some more information on what exactly you're going for would help. If you still want to have separate pages, I think you'd want to have a database with the filenames of each update. The exception would be a directory listing could be changed into an array, but I doubt it can.

Link to comment
Share on other sites

I'm actually trying to get it done with a directory array listing. I'm using a code like this:

 

<?php

$dir = '/archives';

$files = opendir($dir);

while (false !== ($filename = readdir($dir))) {

$files[] = $filename;

}

rsort($files)

for ($i = 0; $i < 4; $i++){

include $files[$i];

}

?>

 

However, when I try to view that, I get this message:

 

Parse error: syntax error, unexpected T_FOR in /home/tartagli/domains/mhq.frih.net/public_html/admin/index.php on line 54

 

Line 54 is: for ($i = 0; $i < 4; $i++){

 

I don't know php well, so I can't tell what the syntax error is. Can anyone help?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.