Darren,
Thanks for the reply. Yes, I've found that if I want an image I need the 
content-type to be image. And it does work, but my main problem is that I 
want to use both in the same document.

If I use a seperate script for the graph that would mean sending all those 
numbers through some "script.pl?numbers=1,2,3,4" method and that's what I 
want to avoid. The reason is, I already calculate everything to generate an 
html table with those numbers, so I wouldn't want to send it again to make a 
graph. 

Basically, I was hoping to do my calculations, send my $vars to a TT template 
that prints out an html table AND a nice graph on the same page. All in one 
go. The graph being dynamic since the reports will be different every time 
and I did hope to avoid having tons of png files to clean up later.

I suppose I may be asking for too much :-) 

I've done some reading and it seems I might be able to use multipart/mixed as 
my content-type. Netscape has many documents on server push/pull and "dynamic 
documents". DD are a mix of html and graphics on the same page. Much like 
those html e-mails you can get with the images and text in the same e-mail. 
Which is what this browser stuff stems from. (According to the docs I've 
read). 

And I've even seen some perl scripts that claim to be able to do this, but the 
examples have not worked yet :(

Sort of like this, but not what I want since I want to use the "mixed" format, 
which prints out different MIME types in sequential order:

print "Content-Type: multipart/x-mixed-place;boundary=myboundary\n\n";
         print "--myboundary\n";


        print "hello world\n";
         print "\n--myboundary\n";

Btw, the above script gives a "premature end of script headers" error.

Okay, that's my spiel on my search for Dynamic Documents using TT and GD.

Thanks again for your help.

-Pablo

On Friday 25 October 2002 05:13 am, darren chamberlain wrote:
> Try something more like:
>
>   # Perl code
>   my $template = Template->new();
>   print "Content-type: image/png\n\n";
>   $template->process('UserPromosOutput.tpl',$vars)
>     or die $template->error;
>
>   # Template
>   [%
>     USE g = GD.Graph.lines(300,200);
>     x = [1, 2, 3, 4];
>     y = [5, 4, 2, 3];
>     g.set(
>             x_label => 'X Label',
>             y_label => 'Y label',
>             title => 'Title'
>     );
>     g.plot([x, y]).png
>   %]
>



_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://www.template-toolkit.org/mailman/listinfo/templates

Reply via email to