Utilitiy dynamic creation of static pages…(I'm not asking this because I want to, rather becasue I have to…)

这一生的挚爱 提交于 2020-01-25 21:22:08

问题


Does anyone know of a utility for ****ahem**** stringing together static pages.

For instance:
Say I wrote a header and a footer of a page, and I only wanted to change the content without ****sigh**** dynamically generating the content of the page. (I.E. the page is dynamically generated, but the end result is just a static page to be dumped into an FTP directory.)

I don't normally endorse doing this sort of thing without something like Tiles or serverside includes on a webserver, but unfortunately my employer __does...__they have use static pages and there's nothing I can do to change their minds. (C++ Programmers)

The closest thing to what I am describing here that I have found would be a utility called cook that's used to build tiddlywiki.

Right, so a utility that can take a directory of:

  • Static Page Parts
    • Header.htm
    • Footer.htm
  • Parts that Change
    • about.htm
    • info.htm
    • products.htm
    • etc.htm

And change it into:

  • Site Build
    • about.htm (with header and footer as well as content of /Parts that Change/about.htm) in between
    • info.htm (same bit...)
    • products.htm (same bit...)
    • etc.htm (same bit...)

回答1:


Sounds like a job for Webby.




回答2:


Sounds like what you want the end result is something that will take N files and stitch the content into a static HTML page that gets uploaded to what I'm assuming is a webserver. Does that sound about right?

I think Dreamweaver has that functionality, but if you want something a little more low level, use this algorithm:

load config file that you use for build parameters
open stream to output file
for each file in source folder 
    load to stream
    write to output stream
close output stream
post file to remote site

Once your pages have been edited, just have your client run this processor. Please let me know if I've totally mis-interpreted what your trying to accomplish.

EDIT: You can also try putting some kind of token in your "dynamic" pages (%HEADER%, %FOOTER%, etc..) and when ever your processor encounters that token replace it with the actual static content.



来源:https://stackoverflow.com/questions/518168/utilitiy-dynamic-creation-of-static-pages-im-not-asking-this-because-i-want

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!