By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,408 Members | 1,576 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,408 IT Pros & Developers. It's quick & easy.

Dynamic Site Methodology

P: n/a
Say you have a site that queries a database and dynamically generates 1000
pages all linked appropriately. Assume the information in the database is
relatively stable, changing on a weekly basis. I see at least two ways to
accomplish this:

1. Make all the pages php and query and create pages on the fly as needed
by the users.

2. Setup a cron task to call a php script and generate all the html pages
once a day during some low usage period.

Obviously, method 2 much more efficient than running MySQL queries for
each user. That said, I don't see many people doing this. I do realize
that PHP caches are designed to reduce the inefficiencies but why even mess
with them when you can create the entire site in html, via php?

Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On Sun, 29 May 2005 18:05:18 GMT, br***@nospam.com (Bruce) wrote:
1. Make all the pages php and query and create pages on the fly as needed
by the users.

2. Setup a cron task to call a php script and generate all the html pages
once a day during some low usage period.


I do #3:

3. Make all pages php and query and create pages on the fly as needed
but cache the results and display the cached result for all subsequent
users if the content hasn't changed.

The reason for this is that while content can change infrequently it's
also unpredictable about when it does change. With a cron task,
changes to the site are not immediate. Also, most of the pages are
custom to each user in some degree (displaying whether or not they are
logged in) even if the content is static. We also rotate ads which is
another reason for keeping the pages at least partially dynamic.

Jul 17 '05 #2

P: n/a
In comp.lang.php
Wayne <no*@here.com> wrote:
On Sun, 29 May 2005 18:05:18 GMT, br***@nospam.com (Bruce) wrote:
1. Make all the pages php and query and create pages on the fly as needed
by the users.

2. Setup a cron task to call a php script and generate all the html pages
once a day during some low usage period.


I do #3:

3. Make all pages php and query and create pages on the fly as needed
but cache the results and display the cached result for all subsequent
users if the content hasn't changed.

The reason for this is that while content can change infrequently it's
also unpredictable about when it does change. With a cron task,
changes to the site are not immediate. Also, most of the pages are
custom to each user in some degree (displaying whether or not they are
logged in) even if the content is static. We also rotate ads which is
another reason for keeping the pages at least partially dynamic.


So are you using a third party caching program like Zend Accelerator or
doing it yourself?
Jul 17 '05 #3

P: n/a
On Sun, 29 May 2005 19:23:07 GMT, br***@nospam.com (Bruce) wrote:
The reason for this is that while content can change infrequently it's
also unpredictable about when it does change. With a cron task,
changes to the site are not immediate. Also, most of the pages are
custom to each user in some degree (displaying whether or not they are
logged in) even if the content is static. We also rotate ads which is
another reason for keeping the pages at least partially dynamic.


So are you using a third party caching program like Zend Accelerator or
doing it yourself?


Do it myself. I don't think Zend Accelerator actually saves you much
work since you still have to mark off what you need to cache yourself.
I do use Turuk MMcache to do execution caching (Accelerator also does
this) but that doesn't have anything to do with managing content.

I have a framework which makes this all pretty easy to add to an
existing site.

Jul 17 '05 #4

P: n/a
Bruce wrote:
Say you have a site that queries a database and dynamically generates 1000
pages all linked appropriately. Assume the information in the database is
relatively stable, changing on a weekly basis. I see at least two ways to
accomplish this:

<snip>

FWIW, <news:11*********************@z14g2000cwz.googlegr oups.com> or
<http://groups-beta.google.com/group/comp.lang.php/msg/d163108151657c33>

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com

Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.