Forum Moderators: coopster

Message Too Old, No Replies

Section on Homepage Updating With Ten Most Recently Accessed Pages

What would a less server intensive approach be?

         

Jeremy_H

5:38 am on Oct 17, 2006 (gmt 0)

10+ Year Member



On my website's homepage, I wanted to make a section of links of the ten most recently accessed pages in my site. (Excluding the homepage).

Since all my pages are in PHP, I was thinking with each non-homepage page load, I can have a MySQL table be written to adding that document to the top of the list, and then delete the 11th item on the list (keeping the list at ten items).

Then on a homepage load, it could read the MySQL table and grab all the links and put them into the special section.

I see this as possible, but also needlessly server intensive.

What would a better approach to this be?

I'm thinking about it, and I don't think the link section needs to be live-to-date. Maybe every 15 minutes--or more--if it would help?

What would a less server intensive approach be to get a feature like this?

Thanks for any suggestions.

jatar_k

5:53 am on Oct 17, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



here's one that's out there

use custom logging to split your server logs so that your primary logs only have page requests and everything else goes to another log

you can see this in this library [webmasterworld.com] thread
Getting PHP session variables into your Apache logs [webmasterworld.com]

just the last part of the first post

now, have a cron run every 15 minutes that grabs the last ten lines off of your log and writes the filenames to a text file that can be included in your homepage.

some ideas here
displaying the last 20 lines from a logfile [webmasterworld.com]

would depend on a fair bit, like having that kind of control in apache, but an idea all the same