|
|
|
|
Perl Webpage CreatorJanuary 2007Background:I've coded this entire site using notpad. It gets tiresome after a while. There are a few things that I have to enter multiple times just to keep the page looking right. I also used to have a couple clunky javascript functions that kept all the pages looking the same.The Problem:First, if you had viewed the html code for a page you would have noticed a call to a javascript function. I wanted to get rid of this because it made it so you couldn't see the actual code used there. A second problem was that adding extra projects or especially diary pages was a lot of work. I had to enter things in multiple places in one file and yet even more in other files. I needed something easier to use so that I'd update my page more often.The solution:I decided a perl script would be the best option to use. I created 2 base programs and a third that deals only with the diary.create_diary_content.pl is run first to dive into the diary directory. It uses a template, specific for the diary pages to create each html. It also creates the content file used by the next script that contains links to all the diary entries. create_page.pl is the bulk of the program. It takes in a template page and any number of needed content pages. It allows for tags to be used in the template and set in content files. The title at the top bar of every page is an example of how I used these tags. Even though that part is set in the title secion of the html code, generating the html code using these perl scripts allows me to set it in the content file. create_site.pl is a script that automates the process of finding all pages and creating them. I put each content file in it's own folder. This script looks in every folder for a "content.txt" and applies the template to it to create the html. make_wedul.bat, finally, is a batch file that contains a command including arguments that is needed to create this entire website. Any time I update it all I have to do is add the extra content and run this file. wedul_content_2007_01_29.zip is a compressed folder containing the structure and content of this website. I'm supplying it in case you are curious to see how the whole thing comes together. What I learned:This program was an excercise in regular expressions. It solidified my perl scripting while enforcing the use of regular expressions.
page last updated January 29, 2007 |
[Home]
[About me]
[My projects]
[Resume]
[In the works]
[online diary]
[TV mount]
[Diffusion]
[N-body]
[Vote Montana]
[Climate Model]
[Portfolio]
[Quantum Computers]
[Poker]
[Triviabot]
[Website Creator]
[Movies]
Site Last Updated February 02, 2010