views:

87

answers:

2

What is the best way to transform large bunches of very similar web pages into a newer css-based layout programatically?

I am changing all the contents of an old website into a new css-based layout. Many of the pages are very similar, and I want to be able to automate the process.

What I am currently thinking of doing is to read the pages in using HtmlAgilityPack, and make a method for each group of similar pages that will create the output text.

What do you think is the best way to do this? The pages mostly differ by things like which .jpg file is used for the image, or how many groups of heading-image-text there are on that particular page

EDIT: I cannot use any other file type than .html, as that is all I am authorized to do. Any suggestions?

EDIT2: Ideally, I would also be able to make this be generic enough that I could use it for many different groups of html files by just switching around a few moving parts.

A: 

Sounds like you should be re-using code. If you are using strictly HTML, I would consider doing PHP or ASP based webpages instead. That way, you can create Header/Content/Footer/Nav sections, and re-use the same code across all your webpages.

This would make it a lot more sustainable, as you would only need to edit one file in the future.

Jon
These things aren't in my control. The site already is up, and has tons of traffic, so changing the file types is not feasible. Plus I don't have authority to do that, even if I wanted to. Any suggestions?
Alex Baranosky
So, you are tasked with converting old HTML Table based websites into CSS based sites. In order to do this, you are going to have to alter the HTML files. If your planning on changing the design without touching the files, then you will need to look into HTML injection.
Jon
A: 

What about using Server Side Includes (SSI) <#!--#INCLUDE -->

This was you can create different parts of your webpage in different files and just "include" them in any other page you want.

header.html body.html footer.html

<html>
<!--#INCLUDE file="header.html" -->
<!--#INCLUDE file="body.html" -->
<!--#INCLUDE file="footer.html" -->
</html>

More info here

Carlo