|
Posted by Jonathan N. Little on 11/01/05 17:30
Ed Jay wrote:
> "Jonathan N. Little" <lws4art@centralva.net> wrote:
>
>
>>Ed Jay wrote:
>>
>>
>>>I'm using a Perl script to generate html pages. I want to use images in
>>>the html page. The fundamental code I use to display an image is:
>>>
>>>print "<p><img src=\"http://www.my-site.com/image.gif\" border=1
>>>width=\"53\" height=\"32\" alt=\"logo\">\n";
>>>
>>>The image doesn't display.
>>>
>>>I have the same problem importing linked external style sheets and
>>>external javascripts.
>>>
>>
>>Best use CGI.pm Then your code would be... I formatted it so your can
>>see the parts without the NG wordwrap confusing things
>>
>>use "CGI";
>>
>>print p(
>> img(
>> {
>> -href=>'http://www.my-site.com/image.gif',
>> -border=>1,
>> -width=>53,
>> -height=>32,
>> -alt=>'logo'
>> }
>> )
>>);
>>
>>if your want it all 'prettified' with CR's and TAB's then
>>
>>use CGI::Pretty;
>
>
> Thanks. You introduced me to the world of Perl modules. I had no idea...
>
Beats the crap out of all that quote escaping and with the CGI.pm your
are less like to make an HTML (actually XHTML 1.0 Transitional) syntax
error. Can also save you a lot of coding...
my @list=qw(one two three four five six);
print ul(li(\@list));
Just imagine:
print p(\@paragraphs);
Also another tip, lookup functions q(), qq() and qw() that can be your
friends ;-)
--
Take care,
Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Navigation:
[Reply to this message]
|