On Mon, Dec 15, 2008 at 1:48 PM, Adam Jimerson <vend...@charter.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Mike Williams wrote:
>
> > Your first question was:
> >
> I'm sorry I guess I should have been more specific in my question, I
> never wanted to try and put perl code ino my HTML page, I know that that
> is impossible because the browser has no clue what to do with it, what I
>  am asking about is embedding the text/html the CGI.pm generates into a
> page where I do have my style at.
>

This is a confusing statement.  If you want to generate the output with a
cgi program, the cgi program has to generate  *all* of the output.

Having the cgi program generate all of the output, and having it use your
style sheet can resolve your problem.


> >> 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.
> >
> > Are you using CGI.pm?
> >
> > If so, you can use css by adding: -style=>{'src'=>'/mystyle.css'} to
> > the aguments of start_html:
> > print $q->start_html(-style=>{'src'=>'/mystyle.css'});
> >
> > This will cause your cgi code to use the stylesheet.
> >
>
> I have tried that and when I tried to call up a div object, in my css
> (is attached) called leftcolumn, instead of getting a navy blue column
> on the left side of the page it is just white.
>

Did you  perhaps  use  'div class='leftcolumn'   ?

That will not work with your stylesheet.

div id='leftcolumn'  *will* work

Here is a little cgi program that uses CGI.pm and your style sheet to print
a some stuff in a blue column on the left side of the screen:
#!/usr/bin/perl
use warnings;
use strict;
use CGI;

my $q = CGI->new();
print $q->header(), $q->start_html(-title=>"list msg test",
-style=>{'src'=>'/css/se.css'}),
      '<div id="leftcolumn">';
for (my $i = 1; $i < 26; $i++) {
    print $q->br("blue column line $i");
}
print '</div>', $q->end_html();



> No I am letting CGI.pm generate the HTML for me, I figured that it would
> be the easiest way to do it.
>
> >
> > Template toolkit is a very useful and powerful tool, but it is
> > probably overkill if all you want to do is use stylesheets.  You can
> > do lots of other things with Template::Toolkit that may make it worth
> > the time is takes to learn how to use it.  For example, having header
> > and footer information that appears on all of the pages on your site
> > in a template, allowing you to make one change to the template and
> > have that effect your entire site.  You can also use template toolkit
> > to generate static pages, so you can use templates to generate pages
> > that do not require cgi, and re-used those templates in you cgi
> > scripts.
> >
>
> - From what I see in the tutorial,
>
> http://template-toolkit.org/docs/tutorial/Web.html#section_Dynamic_Content_Generation_Via_CGI_Script
> ,
> the Templete Toolkit only outputs information from the script, but I
> need it to handle input as well, my script I am working on is a
> guestbook so it needs to get the name of the guest and a message then
> output it, as well as save it to a log for later use by the script.
> Everything works but the plain white background is ugly and doesn't
> match the rest of my site which is why I started this thread.
>

You seem to be under the mistaken impression that you cannot get input using
CGI.pm or Template::Toolkit.

That is incorrect, either of those tools allow you to generate forms that
can be used to get input from the user.

If you look at perldoc CGI the very first screen contains an example of how
to generate a form.

Hope this helps,

Mike

Reply via email to