Hello,
Over the past 10 years or so, I've dabbled in web development, off and on, mostly doing a combination of hand-written html, and php. One of the things I liked to do with php is to create common blocks of code (like a menu bar at the top or side of the pages, or a copyright notice at the bottom of pages), save those code blocks to files, then use php's include() function to include them in my web pages. This allowed me to maintain a single copy of those 'widgets', change them, and have the results reflected on all the pages from the website.
Recently, I've been thinking that running php at runtime for such use seems like it has a number of possible downsides:
* As a site scales in page requests, it adds a lot of extra burden for content which isn't truly dynamic - invoking the php script interpreter/compiler to parse the php source page and re-generate what amounts to the same page every time.
* Any potential security vulnerabilities in php become a potential threat to my site, which if I'm not doing something truly dynamic, seems to be an unnecessary increase in my 'vulnerability footprint'.
So, I wonder, are there any technologies which allow you to generate static pages from templates, doing replacement? Are there any features of php, perl, python, etc which would make it easy to do such a thing without a 'special purpose' tool to 'compile' the static pages for the website? I'm thinking about this, and I suspect I could use PHP, but instead of setting up my website (and links) to access/link files like page_xyz.php, I just tell them to access page_xyz.htm, then from the command line (possibly via a shell script or Makefile), invoke php, passing it page_xyz.php and then saving the output to page_xyz.htm?
Over the past 10 years or so, I've dabbled in web development, off and on, mostly doing a combination of hand-written html, and php. One of the things I liked to do with php is to create common blocks of code (like a menu bar at the top or side of the pages, or a copyright notice at the bottom of pages), save those code blocks to files, then use php's include() function to include them in my web pages. This allowed me to maintain a single copy of those 'widgets', change them, and have the results reflected on all the pages from the website.
Recently, I've been thinking that running php at runtime for such use seems like it has a number of possible downsides:
* As a site scales in page requests, it adds a lot of extra burden for content which isn't truly dynamic - invoking the php script interpreter/compiler to parse the php source page and re-generate what amounts to the same page every time.
* Any potential security vulnerabilities in php become a potential threat to my site, which if I'm not doing something truly dynamic, seems to be an unnecessary increase in my 'vulnerability footprint'.
So, I wonder, are there any technologies which allow you to generate static pages from templates, doing replacement? Are there any features of php, perl, python, etc which would make it easy to do such a thing without a 'special purpose' tool to 'compile' the static pages for the website? I'm thinking about this, and I suspect I could use PHP, but instead of setting up my website (and links) to access/link files like page_xyz.php, I just tell them to access page_xyz.htm, then from the command line (possibly via a shell script or Makefile), invoke php, passing it page_xyz.php and then saving the output to page_xyz.htm?