Jerry Stuckle wrote:
Alec wrote:
>I am starting the creation of a simple news website in PHP, and would
like to include a section for the 'most viewed' or 'most popular'
articles.
As a beginner to PHP, I have looked on google for such tutorials but
to no avail.
Does anyone here know of one?
Many thanks,
Alec
You can either control the downloads yourself and increment a database
counter when a particular article, or you can parse your web server logs
to find out how many times a page has been accessed. Either works fine.
Just to add a bit to Jerry's remarks...
There's probably dozens of ways to do this. Although it is so easy
and ubiquitous to use a database, you can also just open a file and
either increment it or append a new line. The old hit counter trick was
to use a fake 1 pixel image:
<img src="path_to_hit_counter_script" height="1" width="1" alt="" />
That works for static pages as well. Since you are probably serving this
from a database, the database hit counter is probably the easiest to
implement. If you add a timestamp and insert each entry you can fake
your own easy to read server logs. Parsing the real server logs can be a
tough task for a relative newbie.
Google "PHP Hit Counter".
Jeff
>