Jump to content

Recommended Posts

So I'm designing a company's web page and they would like a news page that's easy for them to update.

 

Ultimately what I'd like to give them is two pages. One that lists the 5 most recent headlines of news stories and links to a page with the full story, and another page that does the same thing, except lists every single news article they've ever had. What I'm looking for is a way I can code my page so that my client can simply create a news story in only one document, save it to a folder called "news" or similar on the FTP, and have both listing/link pages automatically display it's headline and link to it. Would this be possible using PHP? If so, can you give me any advice on how I would accomplish this? I've looked around on the web, and found several tutorials, but nearly all of them include creating a submission form and using mySQL, which I'd really rather not bother with.

 

thanks!

Link to comment
https://forums.phpfreaks.com/topic/52719-simple-updating-news-page/
Share on other sites

You can simply use a file to store your links -- one per line -- instead of MySQL.  Take the first five lines (or last five lines; whichever are most recent) for the headlines page; take the rest for the archive page.  If you need more data, like dates and a synopsis, you can also include that, seperated from each other with delimiters.

 

"Flat" file format:

01/01/2007, http://www.news-site.com/story/123, AP - It's New Year's again.....blah blah blah.
01/01/2007, http://www.newssite.com/story/456, Reuters - Blah Blah Blah

 

See the PHP manual -- file system functions, string functions.  That should get you started.

 

(PHP can do it.  It helped me lose 250 lbs AND grow all my hair back AND find true love AND fixed the leaky kitchen faucet.  PHP does it all.)

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.