Re: [PHP-DB] Selecting number of news items on frontpage
David Siegel in "Creating Killer Web Sites" 1st edition said frames are good only for show details of a list of objects like recipes, products or in your case news! You can have a frameset with three frames say top, left and main (center). Put some ad on the top , the headlines of your news on the left and its bodies on the main frame . You can limit the number of headlines using the keyword "limit" ( see MySQL manual ) and put a anchor tag in every headline to a php script passing the "news_id" and show the selected new on the main frame. HTH Jayme. -Mensagem Original- De: Matthew Cothier [EMAIL PROTECTED] Para: [EMAIL PROTECTED] Enviada em: quarta-feira, 28 de fevereiro de 2001 13:13 Assunto: [PHP-DB] Selecting number of news items on frontpage I have a homepage which has a news headline system. Bascially via form the admin of the site can submit news which appears on the front page, the only problem is the news just keeps coming and I have a front page with too many headlines on. How can I make it so that say 7 articles appear on the front page and the rest can be accessed through some sort of archive? Perhaps a link underneath these articles to the archive? And the actual archive a page with the headlines listed that they can click on and view the story, the headlines listed in date order. How would I do this? _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Selecting number of news items on frontpage
Hey, If you're using Mysql to store the items, you could use the Limit statement to limit the number of items displayed. If you're using the file system it'd probably be a little more difficult, but not impossible. For example, if the news items were stored in a text file with one entry per line, you could just use file() to convert the file to an array and then loop 7 times--grabbing the first 7 elements (or news items) of the array. Best Regards, Bill Zeller --- Matthew Cothier [EMAIL PROTECTED] wrote: I have a homepage which has a news headline system. Bascially via form the admin of the site can submit news which appears on the front page, the only problem is the news just keeps coming and I have a front page with too many headlines on. How can I make it so that say 7 articles appear on the front page and the rest can be accessed through some sort of archive? Perhaps a link underneath these articles to the archive? And the actual archive a page with the headlines listed that they can click on and view the story, the headlines listed in date order. How would I do this? _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Selecting number of news items on frontpage
Matthew, Do you want to be told how, or want to read an interesting article on just this, including PHP script to build your archives. It's one of the early PHP tutorials -- try a search on "php movie database". I adapted code from that for my own archive, although I run a shell script, logged in as root, to actually make the directory and copy the files. That has mostly to do with security, although it could probably be overcome by having the archive directory owned by whatever name the webserver runs as. Miles PS Ah, just found it: http://www.webreview.com/pub/2000/02/11/php/index.html That will take you to their archive. Good luck!! PPS The shell script just prompts for a directory name and creates the directory, then copies all files from the web site root into the newly created directory. A second script publishes the new files. Have fun!!! At 04:13 PM 2/28/01 +, Matthew Cothier wrote: I have a homepage which has a news headline system. Bascially via form the admin of the site can submit news which appears on the front page, the only problem is the news just keeps coming and I have a front page with too many headlines on. How can I make it so that say 7 articles appear on the front page and the rest can be accessed through some sort of archive? Perhaps a link underneath these articles to the archive? And the actual archive a page with the headlines listed that they can click on and view the story, the headlines listed in date order. How would I do this? _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Selecting number of news items on frontpage
Matthew, My MySQL syntax is a little rusty. But if you define tables as type "MYISAM" and implement a primary key like this "nArticleKey integer unsigned not null auto_increment primary key" you will have a steadily incrementing count on your articles, as you add them, with no intervention. You could then issue as select statement like " select * from articles limit 7 order by nArticleKey descending" (maybe it should be "top" instead of "limit", check your MySLQ syntax) and feed those to the front page. Store your lowest of the retrieved article numbers, in $lownum, then for the archive, "select * from articles where nArticleKey $lownum descending". Wrangling the results out to the page, etc. I leave to you. Maybe you've done all of this already and I'm just wasting keystrokes? Let me know how it goes, I will go have a look at the page. Regards - Miles At 10:28 PM 2/28/01 +, Matthew Cothier wrote: From: [EMAIL PROTECTED] (Miles Thompson) To: [EMAIL PROTECTED],[EMAIL PROTECTED] Subject: Re: [PHP-DB] Selecting number of news items on frontpage Date: Wed, 28 Feb 2001 17:06:07 -0400 Matthew, Do you want to be told how, or want to read an interesting article on just this, including PHP script to build your archives. It's one of the early PHP tutorials -- try a search on "php movie database". I adapted code from that for my own archive, although I run a shell script, logged in as root, to actually make the directory and copy the files. That has mostly to do with security, although it could probably be overcome by having the archive directory owned by whatever name the webserver runs as. Miles PS Ah, just found it: http://www.webreview.com/pub/2000/02/11/php/index.html That will take you to their archive. Good luck!! PPS The shell script just prompts for a directory name and creates the directory, then copies all files from the web site root into the newly created directory. A second script publishes the new files. Have fun!!! Basically I am using PHP and MySql, is there no way of just grabbing the last 7 articles entered into the database and displaying them and then linking to a page with the rest of them (ie. All the others minus the last 7 - the ones on the front page)? What loop code would I need for this, its a friends site that I have just started : www.sunsetbeachuk.com Thats the url if it helps to take a look, as you will see the front page just grows and grows as more news is added _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Selecting number of news items on frontpage
You could then issue as select statement like " select * from articles limit 7 order by nArticleKey descending" (maybe it should be "top" instead of "limit", check your MySLQ syntax) and feed those to the front page. select * from articles order by nArticleKey desc limit 7 although a better way would be to include a date stamp on the article (which i see you already have, and assuming you have done it in mysql friendly - "Y-m-d H:i:s" then you can do this and get them in reverse chronological order (newest article first) select * from articles order by date desc limit 7 and on the "archive page" select * from articles order by date desc limit ,7 or something like that, see the mysql documentation under the select syntax -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]