http://qs321.pair.com?node_id=610024


in reply to How to make that works with perl

Not sure what you mean, but if you want to make your Perl CGI script output HTML that contains only very little dynamic content ("takes the action from another script" ?) and is mostly created by Dreamweaver you should use one of the popular templating engines (such as Template Toolkit or HTML::Template).

If you have some extra time and control over how the HTML design is done, you should also consider switching over to standards-based design using CSS. That would greatly simplify the HTML that your program has to produce (no more tables, font tags, or nbsps) and make it easier to change the design without touching the program or templates.

Replies are listed 'Best First'.
Re^2: How to make that works with perl
by adam_blackice (Acolyte) on Apr 14, 2007 at 01:00 UTC
    thanx for your replay
    i want to make a dynamic content like a flash banner and adding effects to the page and itis code is indicates above
    that code be possible ?
    what is HTML::Template?
      You want to serve a page that looks like your DreamWeaver page from a CGI/Perl script.

      How the page looks in a web browser depends only on the HTML of that page. It does not matter at all how that HTML was produced on the server-side: It does not matter if it is hand-written in vi, done with DreamWeaver or by print statements in a Perl program. It does not matter if it is static HTML, or made by Perl, Java, COBOL, ASP .

      So, yes, of course, you can write a Perl program that outputs HTML that looks exactly like your DreamWeaver file. The easiest way is to use a templating engine (HTML::Template is one such, just search for it on CPAN or here).

      When you say "dynamic content" you have to distinguish between dynamic for the client, and dynamic for the server. Your flash banner is probably not dynamic content in terms of the server. What I mean is that the HTML (the part that the server produces) will always say src="banner.swf" , which is completely static. If the DreamWeaver page you made (which is static, because it is a static HTML file) already has all the dynamic content you want, you do not need to change that HTML dynamically on the server.

      Examples for server-side dynamic content would be error messages (like "wrong password") that get inserted in the form, or rotating to a different flash banner depending on some clever conditions (although this can usually also be done on the client-side with JavaScript, or by the banner server).

      I hope this is not too confusing for you. If this is your first project with Perl/CGI, I highly recommend you look at some of the tutorials here on PerlMonks. The most important concept to get a handle on IMHO is between what has to happen on the server, and what happens in the web browser. Separating these two parts cleanly can greatly improve maintainability of your application.

      Update: fix CPAN link, GrandFather++