in reply to Re: pulling content from db - is it a good idea?
in thread pulling content from db - is it a good idea?

Thanks, you gave me an idea.

I could have the content in the database, and like you suggested, update a template page (e.g. main.tmpl) when the content changes. I need to have an index.pl as the default page because I figure I need to show some dynamic information on the page (e.g. members' online). I could then use HTML::Template within index.pl to serve out main.tmpl.

What do yout think?

  • Comment on Re: Re: pulling content from db - is it a good idea?

Replies are listed 'Best First'.
Re: pulling content from db - is it a good idea?
by Abigail-II (Bishop) on Nov 25, 2003 at 13:02 UTC
    Members online is some information that doesn't look like it depends on the request being done. Often, for web pages, "members online" isn't anymore more than "this many members accessed the site in the last X minutes". If X is say, 2 minutes, and your site is very active, you might consider updating your index page every 2 minutes (if your site isn't very active, updating every 2 minutes doesn't hurt).

    Unless it's about pages whose content isn't known until the request is made, I wouldn't dismiss static pages to quickly.

    Abigail

      Spot on Abigail-II!

      It is very easy to fall into the trap of serving up everything dynamically. I did that a few projects back and had to do some major re-writing as the site became popular. From serving 100% of the site dynamically it i snow served about 95% statically. But all of the static pages are dynamically created.

      When a user modifies their HTML which is only part of the page, I generate a new static page and store it. It reduces the load on the server drastically. I even have some calendars - instead of generating them each time they are called I generate a static one as an HTML fragment and include it in pseudo-static pages using HTML::Template. At midnight UTC each day I generate about 120 new static pages for the following day, it takes less than 10 seconds to do! The slowest part of the whole operation is replacing the actual files.

      jdtoronto