Hmm... this looks perfect for Template Toolkit. Your CGI script might be something like (this is all very untested):

#!/usr/bin/perl -w use CGI; use strict; use Template; $|++; my $file = "base.tmpl"; my @brokers = &get_brokers; my $template_data = { name => $name, # This would probably get pa +ssed to header.html brokers => \@brokers }; my $template = Template->new( { INCLUDE_PATH => '..\aliasdir1:..\ali +asdir2', ABSOLUTE => 1 } ); $template->process( $file, $template_data ) or die $template->error( +); sub get_brokers { # return an array of hash refs with keys being # qw/ ID name address city state zip phone / }

You template file might look like this:

[% INCLUDE '/hdr/header.html %] [% INCLUDE '/nav/nav.html %] [% INCLUDE '/foot/footer.html %] [% INCLUDE '/content/content1.html %] [% INCLUDE '/content/content2.html %] [% FOREACH broker = brokers %] <ul> <li>[% broker.ID %]</li> <li>[% broker.name %]</li> <li>[% broker.address %]</li> <li>[% broker.city %]</li> <li>[% broker.state %]</li> <li>[% broker.zip %]</li> <li>[% broker.phone %]</li> </ul> [% END %] [% INCLUDE '/content/content3.html %]

That's how easy it is to generate dynamic content with Template Toolkit. Do you need one of the included files to interpolate some variables? Just create a new key in tha anonymous hash in $template_data and reference it in the document with [% keyname %]. I don't see why SSI's would necessarily be superior. Template Toolkit is rather easy to use, once you get over the initial learning curve.

Cheers,
Ovid

Update: The reason I mention the Toolkit instead of SSI is because SSI is slow and, if improperly configured, can result in security holes. Toolkit can turn the templates into subs and cache them, making this a fast, robust system. SSI's are fine for simple things, but as the site gets more complex, the are very limited in what they can do. Since your site is 2000+ pages, I suspect you will quickly run into the inherent limitations in SSI.

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.


In reply to Re: Re: (Ovid) Re: Turning on CGI SSI by Ovid
in thread Turning on CGI SSI by vbrtrmn

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.