Gossamer Forum
Home : General : Perl Programming :

Dynamicaly create pages...

Quote Reply
Dynamicaly create pages...
I'm looking for a script that would do the following (for example):

When someone comes to the site, it will load http://whatever.com/cgi-bin/home.cgi?page=index.htm, which will be a template with the body filled in with whatever index.htm is. Sort of like SSI tags, but different. So when someone clicks on say, the 'contact us' page, it would be something like http://whatever.com/cgi-bin/home.cgi?page=contact.htm, and the template would be the same as before but the body would be contact.htm. Bascially I want the ease of using frames (in that you update one page, it updates them all) but I don't want to use frames.

Hope you all know what I mean. Just want one template, but can have several html pages which act as the body.

If you know how, or if it's already been done, please let me know. I am somewhat knowledgable in Perl, but not a pro yet. I would just rather not do something that maybe someone has already done.

Thanks,
Matt

Quote Reply
Re: Dynamicaly create pages... In reply to
In terms of marketing your site...using this method would not be very good since most SE spiders will ignore dymanic pages (with the ? character).

For information about this, go to:

http://www.searchengineforums.com/

What you could do is use something like, I don't know...LINKS to create your "dynamic" pages. And I think what you are looking for is "consistent design", NOT necessarily "dynamic".

Wink

Regards,

Eliot Lee
Quote Reply
Re: Dynamicaly create pages... In reply to
I appreciate that. I will look at it.

On the one hand, it's not a commercial site, so I wouldn't really care about search engine placement.

So, if that helps you think of anything else, let me know. Thanks in advance.

Matt

Quote Reply
Re: Dynamicaly create pages... In reply to
Why not use LINKS if you want to have a templated web site?

Regards,

Eliot Lee
Quote Reply
Re: Dynamicaly create pages... In reply to
How would that help? That's a directory like Yahoo. I'm just talking about 20 or so pages, with ONE template, and 20 html BODIES.

Thanks,
Matt

Quote Reply
Re: Dynamicaly create pages... In reply to
Uh...it's applications are NOT limited to "directories" or "portals"....

It has been used for the following purposes:

1) Homepage Maker
2) Resume Builder
3) Postcard Sites

etc., etc., etc.

All you have to do is scale back the nph-build.cgi file to only build the pages you want. Then scale back the site_html_templates.pl file to only include the subs that will build the pages you want.

THIS is how it will help you!

Regards,

Eliot Lee
Quote Reply
Re: Dynamicaly create pages... In reply to
And it'll insert html pages in the body of a template on the fly?

Thanks for your help. I'm going to check it out.

-Matt

Quote Reply
Re: Dynamicaly create pages... In reply to
Yes...you can use SSI or tags like:

<%include header.txt%>

to "include" "dynamic" content.

Regards,

Eliot Lee
Quote Reply
Re: Dynamicaly create pages... In reply to
You could use the HTML::Template module from CPAN. I use it in just about every CGI I write.
Read about it at:
http://search.cpan.org/doc/SAMTREGAR/HTML-Template-1.7/Template.pm

It allows for any type of conditional functionality you need and it allows you to cache the template until the template file is modified which makes it very efficient. It works quite well with mod_perl as well.

-- Gordon


s/(\d{2})/chr($1)/ge + print if $_ = '8284703280698276687967';
Quote Reply
Re: Dynamicaly create pages... In reply to
Gordon,

Thanks. Would you happen to have an example of a CGI program you've written that I can look at (one using this template module)? Preferrably a smaller one. I'm relatively new at this, but I don't think what I want to do should be all that difficult.

Thanks,
Matt

Quote Reply
Re: Dynamicaly create pages... In reply to
You can start here for a good reference. It's written by the guy who wrote HTML::Template (which is a killer little module!)

http://www.perlmonth.com/...mplate.html?issue=11

--mark

Installation support is provided via ICQ at UIN# 53788453. I will only respond on that number.
Quote Reply
Re: Dynamicaly create pages... In reply to
Thanks for that.

It looks like they use what I want - .../index.html?issue=11

Does having "issue=11" put in a text file or html file in the variable? Hope that's not a dumb question.

Thanks again.
Matt