Adam Jimerson wrote:
I'm not trying to put perl code into the page, they way I have it now is
I have the page generated by my CGI script inside another page that is
using my CSS.  I've tried to have my CGI script directly handle my CSS
but it didn't work due to its limited support for CSS.  So now I'm
trying to find a better way to make my CGI script look like the rest of
my site, I'm guessing this is what Template Toolkit if I can figure out
how to do it, or if my solution is the best.
I've going to cover some basics here, so I apologise if its starting too low for you.

When a browser requests a URI, the server gets the content of that URI from somewhere and sends it back.

It might get it from a file, it might get it from somewhere else. In the case of CGI, it runs a program and returns that instead.

You need to edit the Perl program that is being called using CGI so it outputs the HTML that you want. (Including the <link> to the stylesheet you are using, there is no problem with support for CSS, since when is output is just HTML, that is comes from a program rather than a file isn't relevant).

We've no idea what method the program is currently using to determine what HTML is generated, so we can't tell you what needs to be done to edit it.

What we can tell you is that using Template-Toolkit is a good approach when it comes to writing this kind of system. When using TT the general approach is to:

(1) Gather up all the data you want into a Perl hash
(2) Tell TT to process a template using that data

TT then goes over the template (which might look something like: http://github.com/dorward/axford/tree/master/root/default.tt (sorry, its got a lot of legacy cruft in it, I'm in the process of cleaning it up) and replaces placeholders with the data (and has things to loop over arrays when you have repeated data).

--
David Dorward
http://dorward.me.uk/

--
To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
For additional commands, e-mail: beginners-cgi-h...@perl.org
http://learn.perl.org/


Reply via email to