Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Dynamically generated static HTML.

Hybrid View

  1. #1

    Dynamically generated static HTML.

    I just had a bit of a thought...

    You see, I'm in love with server side HTML-embedded scripting languages (PHP specifically, but the other ones are good too).

    The problem is, I can't afford a web host that supports PHP, and I don't want to run apache on my own box for security and uptime reasons (my computer's off at night).

    I also know for a fact that I will never in my life attempt to maintain a large, static HTML website ever again. That is such a nightmare.

    So, I was thinking, does anybody know if it would be plausible to just have some textfiles with some basic content in them, and then write a script that would automatically generate the static HTML for me?

    The idea is that I could have my dynamically generated HTML files, which would make my life so much easier, but the end result would be a static HTML file that I could just upload to any free web host.

    I'm planning to write a script to do this in python, but if anybody's heard of something similar that's already been started, let me know

  2. #2

    Re: Dynamically generated static HTML.

    Well, problem is, that functionality is already in SSi's. Server Side inludes. You can edit text files and whatnot and each time a user views the site, it will automagically include the current contents of that include file into the html that thier browser gets.

  3. #3

    Re: Dynamically generated static HTML.

    Yes, but that's the point. It's server side, thus my cheap webhost doesn't support it (nothing but static HTML for me).

    So I just need an easy way to generate static HTML files without having to worry about stupid HTML maintenance

  4. #4

    Re: Dynamically generated static HTML.

    Bah, now I know what you're talking about. I remember someone doing this a while ago with his site. He had his basic layout and then merged it with .txt files with Python. It was quite clever but he didn't provide the code for the python script :-/
    Well, good luck anyway

  5. #5

    Re: Dynamically generated static HTML.

    Thanks. I knew it would work, I was just wondering if it was plausible. I was also hoping somebody else might have a codebase I could start from

    Well, this project is put on hold now that my LFS system is actually becoming useable, but I'll be sure to let you all know how it goes.

  6. #6
    Senior Member
    Join Date
    May 2001

    Re: Dynamically generated static HTML.

    I did something similar using CGI and (ugh!) Visual Basic. Yes, you can do CGI in VB.

    Anyway, it would read in part of a html file (header, part of body, including a table), use code to dynamically generate a form based on a text file, and then spit out the rest of a html file (close table, etc.)

    I guess you could do something similar locally, output files into a directory, then use a perl script to upload all of the files via ftp to your web host.

    Here's some perl that should get the file uploaded for you:

                       use Net::FTP;
                       my(@files) = qw( html_file.html image_file.jpg );
                       system("cd /path/to/files/to/be/uploaded");
                       # Change ' to your ftp server
                       $ftp = Net::FTP->new("");
                       # Replace 'username' and 'password' with the actual login information for the ftp server mentioned above
                       $ftp->login("username", "password");
                       # Change directories
                       # Store the files on
                       foreach $file(@files) {
                               print "Unable to upload file \"$file\".\n\n";
                               print "File \"$file\" stored.\n";

  7. #7

    Re: Dynamically generated static HTML.

    Cool, thanks.

    i'm still working on the perl script that generates the static html, and I have a working version but I don't like it very much (not modular at all, it's a bitch to add a new html file to the website).

  8. #8
    Good Guru
    Compunuts's Avatar
    Join Date
    May 2001

    Re: Dynamically generated static HTML.

    In your case, CGI/Perl is the only option. This LJR is also based on Perl and get dynamically generated on the fly too so you many want to look around with YaBB codebase ( and it's open source AFAIK ).

  9. #9

    Re: Dynamically generated static HTML.

    Bah, I don't need anything nearly that complicated.

    All I really need is to store some text into some variables, then plug those variables into an HTML template, and print them to a file.

    I already have most of it working, I just don't like the way that it's plugging the text into the templates.

    What I need to do is come up with seperate templates for different parts of my site (front page has a different template than a page describing something I've coded, etc), so that way I can get more of the actual HTML markup out of my variables and into my templates.

    Hey, maybe I should do this with OO? That would be neat-o practise (and the first time I've ever applied OO to a real-world situation ). I could have some basic methods (templates) created, and override them for different pages. I think I'll do that

  10. #10

    Re: Dynamically generated static HTML.

    Hey, maybe I should do this with OO?
    I have a nearly working implementation of this, it's pretty cool. OO proved to be far more useful than I had originally though!

    Right now the object itself is pretty much finished, all I have to do is tweak the way that the object gets created to make the program more 'user friendly' and such, but I think for the most part I'm done! Mwahahahha...

    Now, time for that calculus homework... geh.

Similar Threads

  1. setting static IP on network with no static IP address from internet provider?
    By solvetek in forum Linux - Hardware, Networking & Security
    Replies: 4
    Last Post: 11-16-2011, 07:23 AM
  2. changing location of dynamically linked library
    By countach44 in forum Linux - Software, Applications & Programming
    Replies: 0
    Last Post: 08-12-2009, 10:36 PM
  3. dynamically changing delay pool acl squid.conf
    By lasanthaindika in forum Linux - Software, Applications & Programming
    Replies: 0
    Last Post: 05-03-2009, 08:04 AM
  4. diff and patch-Deleting the newly generated file
    By shailesh mishra in forum Redhat / Fedora
    Replies: 0
    Last Post: 12-18-2007, 05:46 AM
  5. dynamically/staticly linked QT
    By agar in forum Linux - General Topics
    Replies: 2
    Last Post: 11-26-2001, 01:55 PM


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts