473,739 Members | 2,602 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why not generate static pages instead of dynamic?

There must be millions of dynamically generated
html pages out there now, built by on-the-fly php code
(and jsp, perl cgi, asp, etc).

Programatic page generation is transparently useful.
But querying a database, negotiatinig lots of if-then-else logic
and echo'ing html code out on port 80 every time a
page is requested has to be a huge waste of resources.

Why not use that logic to print static html instead of dynamic?
The few pages that need to be dynamic (perhaps the results of a
database
query) probably represent only a small fraction of the total
number of pages that are rendered by on the fly code.

Seems to make sense to me. All you need to do is work
the output directories into your code logic somehow,
and do a few one-time-only mkdirs before printing out the static html.

Am I missing something?
Why is it so little open source page generation software acually
works that way?

Oct 16 '06 #1
5 3176
On Mon, 16 Oct 2006 12:33:19 -0700, pittendrigh wrote:
There must be millions of dynamically generated html pages out there
now, built by on-the-fly php code (and jsp, perl cgi, asp, etc).

Programatic page generation is transparently useful. But querying a
database, negotiatinig lots of if-then-else logic and echo'ing html code
out on port 80 every time a page is requested has to be a huge waste of
resources.

Why not use that logic to print static html instead of dynamic? The few
pages that need to be dynamic (perhaps the results of a database
query) probably represent only a small fraction of the total number of
pages that are rendered by on the fly code.

Seems to make sense to me. All you need to do is work the output
directories into your code logic somehow, and do a few one-time-only
mkdirs before printing out the static html.

Am I missing something?
Why is it so little open source page generation software acually works
that way?
If a page has information on it that changes depending on the desired
content it cannot be a static page, otherwise it is a static page.

I'm not sure what your confusion is.

Oct 16 '06 #2
pittendrigh wrote:
There must be millions of dynamically generated
html pages out there now, built by on-the-fly php code
(and jsp, perl cgi, asp, etc).

Programatic page generation is transparently useful.
But querying a database, negotiatinig lots of if-then-else logic
and echo'ing html code out on port 80 every time a
page is requested has to be a huge waste of resources.

Why not use that logic to print static html instead of dynamic?
The few pages that need to be dynamic (perhaps the results of a
database
query) probably represent only a small fraction of the total
number of pages that are rendered by on the fly code.

Seems to make sense to me. All you need to do is work
the output directories into your code logic somehow,
and do a few one-time-only mkdirs before printing out the static html.

Am I missing something?
Why is it so little open source page generation software acually
works that way?
If I recall correctly, Smarty does something similar with it's caching.
Once a page is generated, it can be cached for a period of time so
that subsequent requests don't load the acutal page, but a static
version.

I see what you're trying to say, but don't agree with your assertion
that only a small fraction of pages need to be truly dynamic. Sure,
things like blogs or community webpages (or any page that only gets
updated once per day or slower) could benefit from serving static pages
and regenerating them at periodic intervals, but many web apps *need*
to be dynamically served at each page request. 90% of the pages in the
app I develop for need to show up-to-the-minute information from when
the page loads.

I haven't done the performance tests to see how serving up a cached
Smarty page vs a dynamically generated page compares, but I would guess
that the benefits are trivial to most people. If you're dealing with
traffic on the yahoo/ebay/google scale, then maybe that tiny boost
could mean hundreds of thousands of dollars in savings, but for most
people I don't think it really matters that much.

Oct 16 '06 #3


pittendrigh wrote:
There must be millions of dynamically generated
html pages out there now, built by on-the-fly php code
(and jsp, perl cgi, asp, etc).

Programatic page generation is transparently useful.
But querying a database, negotiatinig lots of if-then-else logic
and echo'ing html code out on port 80 every time a
page is requested has to be a huge waste of resources.

Why not use that logic to print static html instead of dynamic?
The few pages that need to be dynamic (perhaps the results of a
database
query) probably represent only a small fraction of the total
number of pages that are rendered by on the fly code.

Seems to make sense to me. All you need to do is work
the output directories into your code logic somehow,
and do a few one-time-only mkdirs before printing out the static html.

Am I missing something?
Why is it so little open source page generation software acually
works that way?
Hi,

I made a CMS that will create some 'static' html files on the server. When the
page changes, the page is generated again and written to the server again. This
way I save a lot of db queries and resources.

When the page needs something dynamic (like scheduled newsitems) it is fetched
through AJAX or (users choice) a 'more-dynamic' page (php and in the future also
in Perl or ASP) is generated.

The reason I choose this method had to do with the fact that the user of the CMS
should be able to easily link to a generated page. For most of the people it is
easier to search for somthing linke http://mydomain.com/aboutus.htm than
http://mydomain.com/index.php?page=aboutus or something similiar.

It works for my project...

Snef
Oct 16 '06 #4
Rik
Snef wrote:
pittendrigh wrote:
>There must be millions of dynamically generated
html pages out there now, built by on-the-fly php code
(and jsp, perl cgi, asp, etc).

Programatic page generation is transparently useful.
But querying a database, negotiatinig lots of if-then-else logic
and echo'ing html code out on port 80 every time a
page is requested has to be a huge waste of resources.

Why not use that logic to print static html instead of dynamic?
The few pages that need to be dynamic (perhaps the results of a
database
query) probably represent only a small fraction of the total
number of pages that are rendered by on the fly code.

Seems to make sense to me. All you need to do is work
the output directories into your code logic somehow,
and do a few one-time-only mkdirs before printing out the static
html.

Am I missing something?
Why is it so little open source page generation software acually
works that way?
Hi,

I made a CMS that will create some 'static' html files on the server.
When the page changes, the page is generated again and written to the
server again. This way I save a lot of db queries and resources.

When the page needs something dynamic (like scheduled newsitems) it
is fetched through AJAX or (users choice) a 'more-dynamic' page (php
and in the future also in Perl or ASP) is generated.

The reason I choose this method had to do with the fact that the user
of the CMS should be able to easily link to a generated page. For
most of the people it is easier to search for somthing linke
http://mydomain.com/aboutus.htm than
http://mydomain.com/index.php?page=aboutus or something similiar.
There are many reasons to use static pages, but this is not one of them.
Using .htaccess or similar, you can fetch requests easily. I usually use a
hierarchical tree for pages, like directories, so:
http://www.example.com/page1/sub3/ etc...

These directories do not exist, but route to the same php file, which
serves up the pages (be they database driven or included html-files, logs
specific requests for the stats, and performs any other actions required by
that page.

Static pages can be good for sites that don't change that often, with
little to no interaction, but readable urls is not a reason for it.

The way Moot mentions, creating html-files on the fly on changes, and serve
them up, is a method I've used often, no sense in keep generating the
pages. But they'll route through the php, which will check wether it's a
dynamic/user-interaction page or not, and on that basis will serve the html
file or build the page (and log traffic, specific requests, referrers etc).

Added bonus is that when a database is stretched for resources or
unavailable, a lot can be served, and you can even tell the users to come
back later on the dynamic pages when the database is unavailable. It
shouldn't be offcourse, but the safer the better :-).

Grtz,
--
Rik Wasmus
Oct 16 '06 #5


Rik wrote:
Snef wrote:
>pittendrigh wrote:
>>There must be millions of dynamically generated
html pages out there now, built by on-the-fly php code
(and jsp, perl cgi, asp, etc).

Programatic page generation is transparently useful.
But querying a database, negotiatinig lots of if-then-else logic
and echo'ing html code out on port 80 every time a
page is requested has to be a huge waste of resources.

Why not use that logic to print static html instead of dynamic?
The few pages that need to be dynamic (perhaps the results of a
database
query) probably represent only a small fraction of the total
number of pages that are rendered by on the fly code.

Seems to make sense to me. All you need to do is work
the output directories into your code logic somehow,
and do a few one-time-only mkdirs before printing out the static
html.

Am I missing something?
Why is it so little open source page generation software acually
works that way?
Hi,

I made a CMS that will create some 'static' html files on the server.
When the page changes, the page is generated again and written to the
server again. This way I save a lot of db queries and resources.

When the page needs something dynamic (like scheduled newsitems) it
is fetched through AJAX or (users choice) a 'more-dynamic' page (php
and in the future also in Perl or ASP) is generated.

The reason I choose this method had to do with the fact that the user
of the CMS should be able to easily link to a generated page. For
most of the people it is easier to search for somthing linke
http://mydomain.com/aboutus.htm than
http://mydomain.com/index.php?page=aboutus or something similiar.

There are many reasons to use static pages, but this is not one of them.
Using .htaccess or similar, you can fetch requests easily. I usually use a
hierarchical tree for pages, like directories, so:
http://www.example.com/page1/sub3/ etc...

These directories do not exist, but route to the same php file, which
serves up the pages (be they database driven or included html-files, logs
specific requests for the stats, and performs any other actions required by
that page.

Static pages can be good for sites that don't change that often, with
little to no interaction, but readable urls is not a reason for it.

The way Moot mentions, creating html-files on the fly on changes, and serve
them up, is a method I've used often, no sense in keep generating the
pages. But they'll route through the php, which will check wether it's a
dynamic/user-interaction page or not, and on that basis will serve the html
file or build the page (and log traffic, specific requests, referrers etc).

Added bonus is that when a database is stretched for resources or
unavailable, a lot can be served, and you can even tell the users to come
back later on the dynamic pages when the database is unavailable. It
shouldn't be offcourse, but the safer the better :-).

Grtz,
Rik,

Don't understand me wrong... my story didn't come out that well i think. I want
the pages to be generated for the customer so that they can easily look them up
in a editor (link FCKEditor). They just go to the directory where the file is an
select it to create a link. That is the easiest way for customers (for this
project). So the coice to use generated 'static' files is not just to create
those urls! I know i can use .htaccess to create friendly urls (if I had apache,
but I don't).

The main reason was to lower the use of database requests and other resources.
And for my project I needed those URL's but that was not the reason to do it
this way! :)

Snef.
Oct 17 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
2313
by: Fred | last post by:
Hi, I'm sure there are a bunch of them, but googling just returned full-fledged CMS that require a DBMS and generate dynamic pages. I'd just like a script that would 1. look in a directory for articles in raw HTML, 2. generate a cooked output for each page (ie. add header and footer, CSS link in HEAD, etc.), 3. regenerate the homepage with "Last modified" bit following each
49
3113
by: bearophileHUGS | last post by:
Adding Optional Static Typing to Python looks like a quite complex thing, but useful too: http://www.artima.com/weblogs/viewpost.jsp?thread=85551 I have just a couple of notes: Boo (http://boo.codehaus.org/) is a different language, but I like its "as" instead of ":" and "->", to have: def min(a as iterable(T)) as T: Instead of:
0
1597
by: gg.2.starfire | last post by:
WebCheck (http://www.raycosoft.com/rayco/products/webcheck) is a program for testing and analyzing static or dynamic web pages. WebCheck fetches web pages, applies detailed tests to each web page and generates a concise report. WebCheck can pass form parameters, cookies and userids/passwords to web pages, and it can test web pages locally before they are installed on the web server. The program can e-mail the report and/or save it to a...
0
332
by: Nick | last post by:
Hi all, I'm about to embark on a new project and can't decide quite how to do it. In summary, I have a database whose data I want to use to create html pages for a website. The website will just be a series of static html pages. I will keep all the data locally and would generate the required pages and upload them whenever I needed to. I do not want to have the database anywhere but on my lcoal machine. My questions are:
2
1554
by: Adnan Al-Ghourabi | last post by:
Hi, We have a need to create pages on the fly for ASP.NET applications based on some string that the Url ends with. For example: http://www.domain.com/SomePath/aabbccdd. "aabbccdd" does not exist physically on the file system, but we'd like that to be handled somehow as an ID, make a call to some other system to retrieve data (Web Service, database etc.), and then generate a response page.
5
1894
by: vikram | last post by:
I am developing a display web site which displays several listing and details, data is picked up from database for the lists. There is no search criteria but only pagination stuff. What i am thinkin gis to create a program which will read data and generate static html pages for the lists and dump the pages on the web server. when user will acees they will acces html pages instead of aspx pages, helps perfroamnce improveents. Is it a right...
24
19086
by: Ken | last post by:
In C programming, I want to know in what situations we should use static memory allocation instead of dynamic memory allocation. My understanding is that static memory allocation like using array is faster than malloc, but dynamic memory allocation is more flexible. Please comment... thanks.
7
8222
by: Jo | last post by:
Hi, How can i differentiate between static and dynamic allocated objects? For example: void SomeFunction1() { CObject *objectp = new CObject; CObject object;
6
3564
by: Marvin Barley | last post by:
I have a class that throws exceptions in new initializer, and a static array of objects of this type. When something is wrong in initialization, CGI program crashes miserably. Debugging shows uncaught exception. How to catch an exception that happened before main() try { ... } catch (...) { ... } block? Is there a way?
0
8969
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8792
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9479
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9266
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8215
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6754
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4570
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3280
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.