Microsys Template

Using the Microsys Template in a Script

Assumptions

Perl Scripts

You can directly apply Dreamweaver templates using the use HTML::DWT::Simple module, installed on scripts00 and uni04nt . TODO: get use HTML::DWT::Simple into Subversion for disaster recovery!

#!C:\perl\bin\perl.exe


use HTML::DWT::Simple;		# for dreamweaver templates


# read in template
my $template = new HTML::DWT::Simple(filename => "MicrosysCSS.dwt" ); 

# get a list of Editable Regions exposed in this template
my @regions = $template->param();

# write template with editable regions replaced
my %foo = ( doctitle => "A test of HTML::DWT::Simple", PageHeading => "A test of HTML::DWT::Simple", LastUpdated => scalar localtime(), body => '<pre>Hello, World!</pre>' );
open( OUTPUT, ">test.html" ) or die "Unable to write to test.html! $!";

$template->param( %foo );
$template->output( print_to => \*OUTPUT );
close( OUTPUT );

Other Scripting Languages

There is a small script, applyDWT.pl, which will "apply" a Dreamweaver template to a file. If the file has the html markup to indicate editable regions, they will be replaced with the indicated content. If the file isn't marked up, you can sp

Options:

-t template to apply (defaults to microsysCSS.dwt)
-u editable region to receive file's contents (defaults to 'body')
-v if specified, be verbose (not verbose by default)
-w translate \ to // in filenames (no translation by default)
-d update editable region.

Examples

Apply the default template to report.log, which is inserted into the 'body' editable region.

applyDWT.pl report.log

Rename report.log to report.html, and set the doctitle and PageHeading to "this is a test"

rem Assuming this is windows, otherwise use 'mv'
ren report.log report.html


applyDWT.pl -d doctitle="this is a test",PageHeading="this is a test" report.html

The LastUpdated region is special, you do not explicitly set a value with an equals sign, instead it always uses the current time.

applyDWT.pl -d LastUpdated report.html

The applyDWT.pl script is installed on scripts00 under Scripts\generate-webpages .

TODO: get this into Subversion for disaster recovery!

About Microsys | Accessibility in our Services | Feedback | Microsys RSS Feeds | Page updated October 3, 2006