Clean and Effecient News

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Ranqe Twist
Forum Newbie
Posts: 4
Joined: Fri Jul 23, 2010 4:22 pm

Clean and Effecient News

Post by Ranqe Twist »

I have a idea for news on my website. I thought this would be really easy and effecient.

Idea:
-A document is stored in a file on website[News] for every day.
-Varibles for author, topic, post, and salutation all in the files.
-The main page where the news article will be displayed checks the file for today's date and if there is a news article filled in, then it displays todays. If not, it displays the most recent article.

Ex:
public_html/home/news/site_news/(Date Here)
*footnote: In America we do MM/DD/YYYY for date formatting.
10/1/2010:No article
10/2/2010:No article
10/3/2010:Article
10/4/2010:No article
10/5/2010:No article
Since today is 10/5/2010 and there is no article for today, it checks yesterday, 10/4/2010. Since there are no articles for yesterday, It checks 2 days ago, 10/3/2010. There is a article for 10/3/2010 so it will display it.

----------------

Also I'm trying to figure out how to have a "Read More.." link added if the post is to long.

Ex:
PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML.
Instead of lots of commands to output HTML (as seen in C or Perl), PHP pages contain HTML with embedded code that does "something" (in this case, output "Hi, I'm a PHP script!"). The PHP code is enclosed in special start and end processing instructions <?php and ?> that allow you to jump into and out of "PHP mode." What distinguishes PHP from something like client-side JavaScript is that the code is executed on the server, generating HTML Read More..

Still left of the next:
which is then sent to the client. The client would receive the results of running that script, but would not know what the underlying code was. You can even configure your web server to process all your HTML files with PHP, and then there's really no way that users can tell what you have up your sleeve.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Clean and Effecient News

Post by requinix »

Don't use files. Use a database.
Ranqe Twist
Forum Newbie
Posts: 4
Joined: Fri Jul 23, 2010 4:22 pm

Re: Clean and Effecient News

Post by Ranqe Twist »

What do you mean? I know what a database is but how would I set that up? ;o.
Post Reply