RE: Trying to add hyperlink
Thanx Clarles.This code is really cool. I was looking something like this . -Original Message- From: Charles K. Clarkson [mailto:[EMAIL PROTECTED] Sent: Thursday, June 22, 2006 10:22 PM To: beginners@perl.org Subject: RE: Trying to add hyperlink chen li wrote: : How to convert the format above into an OOP style when : adding a hyperlink? I am afraid many people might : have typo if they follow the format above. First, let's fix a few things with this implementation. Use the -w or the warnings pragma, not both. The preference is for the pragma. Read pererllexwarn in the docs for details. Always use strict. : #!/usr/bin/perl -w : use warnings; #!/usr/bin/perl use strict; use warnings; : use CGI qw/:standard/; : print header, start_html(Stsd ILO Links), h1(Stsd ILO Links); : : print table({-border=undef,,-width='75%', -height='70%'}, Under xhtml there is no height attribute for tables, you are required to present a summary and 'border' cannot be undef under CGI.pm. You also have an extra comma up there, though I don't think it hurts anything. print header(), start_html( 'Stsd ILO Links' ), h1( 'Stsd ILO Links' ), table( { -border = 0, -width = '75%', -summary = 'Table of Enclosure features', }, : caption(strong('Web Page Under construction?')), : Tr({-align=CENTER,-valign=TOP}, Under 'use strict', CENTER and TOP are illegal barewords. Put them in quotes. Valid xhtml requires 'center' and 'top' (no capitilization). Tr( { -align = 'center', -valign = 'top' }, : [ :th(['','Network Switch','Bay 1','Bay 2','Bay 3' ,'Network Switch' ]), :th('Enclosure 1').td(['Bl20p G2','yes','yes']), :th('Enclosure 2').td(['no','no','yes']) th( 'Enclosure 1' ) . td( [ a( { -href = '/' }, 'Bl20p G2' ), a( { -href = '/' }, 'yes' ), a( { -href = '/' }, 'yes' ), ] ), th( 'Enclosure 2' ) . td( [ a( { -href = '/' }, 'no' ), a( { -href = '/' }, 'no' ), a( { -href = '/' }, 'yes' ), ] ), : ] : ) : ); Use a comma here instead of a semicolon or add a print statement to the next line. As Prabu already mentioned, you need to add an anchor to each box you want to link from. There's no easy way around it. We could use a subroutines to eliminated some typing. use strict; use warnings; use CGI qw/:standard/; print header(), start_html( 'Stsd ILO Links' ), h1( 'Stsd ILO Links' ), table( { -border = 0, -width = '75%', -summary = 'Table of Enclosure features', }, caption( strong( 'Web Page Under construction?' ) ), Tr( { -align = 'center', -valign = 'top' }, [ th( [ '', 'Network Switch', 'Bay 1', 'Bay 2', 'Bay 3', 'Network Switch' ] ), row( 'Enclosure 1', '/' = 'Bl20p G2', '/' = 'yes', '/' = 'yes', ), row( 'Enclosure 2', '/' = 'no', '/' = 'no', '/' = 'yes', ), ] ) ), end_html(); sub row { my $name = shift; return th( 'Enclosure 2' ) . td( anchors( @_ ) ); } sub anchors { my @anchors = @_; my @return; while ( @anchors ) { push @return, a( { -href = shift @anchors }, shift @anchors ), } return [EMAIL PROTECTED]; } __END__ In OO style. use strict; use warnings; use CGI; my $q = CGI-new(); print $q-header(), $q-start_html( 'Stsd ILO Links' ), $q-h1( 'Stsd ILO Links' ), $q-table( { -border = 0, -width = '75%', -summary = 'Table of Enclosure features', }, $q-caption( $q-strong( 'Web Page Under construction?' ) ), $q-Tr( { -align = 'center
Re: Trying to add hyperlink
Hello, Hope this is your need... #!/usr/bin/perl -w use warnings ; use CGI qw/:standard/; print header, start_html(Stsd ILO Links), h1(Stsd ILO Links) ; print table({-border=undef,,-width='75%', -height='70%'}, caption(strong('Web Page Under construction?')), Tr({-align=CENTER,-valign=TOP}, [ th(['','A HREF=#Network Switch/A','A HREF=#Bay 1/A','A HREF=#Bay 2/A','A HREF=#Bay 3/A' ,'A HREF=#Network Switch/A' ]), th('A HREF=#Enclosure 1/A').td(['A HREF=#Bl20p G2/A','A HREF=#yes/A','A HREF=#yes/A']), th('A HREF=#Enclosure 2/A').td(['A HREF=#no/A','A HREF=#no/A','A HREF=#yes/A']) ] ) ); end_html(); -- Prabu.M.A When I was born I was so surprised I didnt talk for a period and half -Gracie Allen Nath, Alok (STSD) wrote: Hi, I was trying to add a hyperlink to each of the boxes but it was not putting it in the right place.Can anyone help me in this regard ? #!/usr/bin/perl -w use warnings ; use CGI qw/:standard/; print header, start_html(Stsd ILO Links), h1(Stsd ILO Links) ; print table({-border=undef,,-width='75%', -height='70%'}, caption(strong('Web Page Under construction?')), Tr({-align=CENTER,-valign=TOP}, [ th(['','Network Switch','Bay 1','Bay 2','Bay 3' ,'Network Switch' ]), th('Enclosure 1').td(['Bl20p G2','yes','yes']), th('Enclosure 2').td(['no','no','yes']) ] ) ); end_html(); Also can anyone point me the links for Perl CGI tutorials with emphasis on handling tables and forms. Thanx, Alok. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Trying to add hyperlink
Nath, Alok (STSD) wrote: Hi, I was trying to add a hyperlink to each of the boxes but it was not putting it in the right place.Can anyone help me in this regard ? [...] Try this: td([ a({href='http://url.example.com'}, 'My link text') ]) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Trying to add hyperlink
Hi Prabhu, Is there any simple way of doing it.Bcos this looks like user has to type a lot. Perl is known for its simplicity I suppose. Thanx, Alok. -Original Message- From: Prabu [mailto:[EMAIL PROTECTED] Sent: Thursday, June 22, 2006 12:06 PM To: Nath, Alok (STSD) Cc: beginners@perl.org Subject: Re: Trying to add hyperlink Hello, Hope this is your need... #!/usr/bin/perl -w use warnings ; use CGI qw/:standard/; print header, start_html(Stsd ILO Links), h1(Stsd ILO Links) ; print table({-border=undef,,-width='75%', -height='70%'}, caption(strong('Web Page Under construction?')), Tr({-align=CENTER,-valign=TOP}, [ th(['','A HREF=#Network Switch/A','A HREF=#Bay 1/A','A HREF=#Bay 2/A','A HREF=#Bay 3/A' ,'A HREF=#Network Switch/A' ]), th('A HREF=#Enclosure 1/A').td(['A HREF=#Bl20p G2/A','A HREF=#yes/A','A HREF=#yes/A']), th('A HREF=#Enclosure 2/A').td(['A HREF=#no/A','A HREF=#no/A','A HREF=#yes/A']) ] ) ); end_html(); -- Prabu.M.A When I was born I was so surprised I didnt talk for a period and half -Gracie Allen Nath, Alok (STSD) wrote: Hi, I was trying to add a hyperlink to each of the boxes but it was not putting it in the right place.Can anyone help me in this regard ? #!/usr/bin/perl -w use warnings ; use CGI qw/:standard/; print header, start_html(Stsd ILO Links), h1(Stsd ILO Links) ; print table({-border=undef,,-width='75%', -height='70%'}, caption(strong('Web Page Under construction?')), Tr({-align=CENTER,-valign=TOP}, [ th(['','Network Switch','Bay 1','Bay 2','Bay 3' ,'Network Switch' ]), th('Enclosure 1').td(['Bl20p G2','yes','yes']), th('Enclosure 2').td(['no','no','yes']) ] ) ); end_html(); Also can anyone point me the links for Perl CGI tutorials with emphasis on handling tables and forms. Thanx, Alok. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Trying to add hyperlink
Hello Alok, FineBut each box needs to go to different link right.So it should be specified in each box .. If not can u a give me little more detailed requirement like on clicking the link in box where it should go.and so... -- Prabu.M.A When I was born I was so surprised I didnt talk for a period and half -Gracie Allen Nath, Alok (STSD) wrote: Hi Prabhu, Is there any simple way of doing it.Bcos this looks like user has to type a lot. Perl is known for its simplicity I suppose. Thanx, Alok. -Original Message- From: Prabu [mailto:[EMAIL PROTECTED] Sent: Thursday, June 22, 2006 12:06 PM To: Nath, Alok (STSD) Cc: beginners@perl.org Subject: Re: Trying to add hyperlink Hello, Hope this is your need... #!/usr/bin/perl -w use warnings ; use CGI qw/:standard/; print header, start_html(Stsd ILO Links), h1(Stsd ILO Links) ; print table({-border=undef,,-width='75%', -height='70%'}, caption(strong('Web Page Under construction?')), Tr({-align=CENTER,-valign=TOP}, [ th(['','A HREF=#Network Switch/A','A HREF=#Bay 1/A','A HREF=#Bay 2/A','A HREF=#Bay 3/A' ,'A HREF=#Network Switch/A' ]), th('A HREF=#Enclosure 1/A').td(['A HREF=#Bl20p G2/A','A HREF=#yes/A','A HREF=#yes/A']), th('A HREF=#Enclosure 2/A').td(['A HREF=#no/A','A HREF=#no/A','A HREF=#yes/A']) ] ) ); end_html(); -- Prabu.M.A When I was born I was so surprised I didnt talk for a period and half -Gracie Allen Nath, Alok (STSD) wrote: Hi, I was trying to add a hyperlink to each of the boxes but it was not putting it in the right place.Can anyone help me in this regard ? #!/usr/bin/perl -w use warnings ; use CGI qw/:standard/; print header, start_html(Stsd ILO Links), h1(Stsd ILO Links) ; print table({-border=undef,,-width='75%', -height='70%'}, caption(strong('Web Page Under construction?')), Tr({-align=CENTER,-valign=TOP}, [ th(['','Network Switch','Bay 1','Bay 2','Bay 3' ,'Network Switch' ]), th('Enclosure 1').td(['Bl20p G2','yes','yes']), th('Enclosure 2').td(['no','no','yes']) ] ) ); end_html(); Also can anyone point me the links for Perl CGI tutorials with emphasis on handling tables and forms. Thanx, Alok. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Trying to add hyperlink
Prabu wrote: : use CGI qw/:standard/; [snip] : th(['','A HREF=#Network Switch/A','A HREF=#Bay 1/A','A : HREF=#Bay 2/A','A HREF=#Bay 3/A' ,'A HREF=#Network : Switch/A' ]), Sorry, that will produce invalid xhtml 1.0 Transitional, the default DOCTYPE for CGI.pm. Better to use the a() function already loaded into the main namespace by the 'use' statement. It will automatically change the output should the -noxhtml CGI.pm pragma is added later. HTH, Charles K. Clarkson -- Mobile Homes Specialist Free Market Advocate Web Programmer 254 968-8328 Don't tread on my bandwidth. Trim your posts. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Trying to add hyperlink
Hi Prabhu, Your guess is right.For each box it should go to a different link. For e.g my references are like this. href=https://192.10.11.12. I want my code to be slightly simple. Thanx, Alok. -Original Message- From: Prabu [mailto:[EMAIL PROTECTED] Sent: Thursday, June 22, 2006 1:51 PM To: Nath, Alok (STSD) Cc: beginners@perl.org Subject: Re: Trying to add hyperlink Hello Alok, FineBut each box needs to go to different link right.So it should be specified in each box .. If not can u a give me little more detailed requirement like on clicking the link in box where it should go.and so... -- Prabu.M.A When I was born I was so surprised I didnt talk for a period and half -Gracie Allen Nath, Alok (STSD) wrote: Hi Prabhu, Is there any simple way of doing it.Bcos this looks like user has to type a lot. Perl is known for its simplicity I suppose. Thanx, Alok. -Original Message- From: Prabu [mailto:[EMAIL PROTECTED] Sent: Thursday, June 22, 2006 12:06 PM To: Nath, Alok (STSD) Cc: beginners@perl.org Subject: Re: Trying to add hyperlink Hello, Hope this is your need... #!/usr/bin/perl -w use warnings ; use CGI qw/:standard/; print header, start_html(Stsd ILO Links), h1(Stsd ILO Links) ; print table({-border=undef,,-width='75%', -height='70%'}, caption(strong('Web Page Under construction?')), Tr({-align=CENTER,-valign=TOP}, [ th(['','A HREF=#Network Switch/A','A HREF=#Bay 1/A','A HREF=#Bay 2/A','A HREF=#Bay 3/A' ,'A HREF=#Network Switch/A' ]), th('A HREF=#Enclosure 1/A').td(['A HREF=#Bl20p G2/A','A HREF=#yes/A','A HREF=#yes/A']), th('A HREF=#Enclosure 2/A').td(['A HREF=#no/A','A HREF=#no/A','A HREF=#yes/A']) ] ) ); end_html(); -- Prabu.M.A When I was born I was so surprised I didnt talk for a period and half -Gracie Allen Nath, Alok (STSD) wrote: Hi, I was trying to add a hyperlink to each of the boxes but it was not putting it in the right place.Can anyone help me in this regard ? #!/usr/bin/perl -w use warnings ; use CGI qw/:standard/; print header, start_html(Stsd ILO Links), h1(Stsd ILO Links) ; print table({-border=undef,,-width='75%', -height='70%'}, caption(strong('Web Page Under construction?')), Tr({-align=CENTER,-valign=TOP}, [ th(['','Network Switch','Bay 1','Bay 2','Bay 3' ,'Network Switch' ]), th('Enclosure 1').td(['Bl20p G2','yes','yes']), th('Enclosure 2').td(['no','no','yes']) ] ) ); end_html(); Also can anyone point me the links for Perl CGI tutorials with emphasis on handling tables and forms. Thanx, Alok. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Trying to add hyperlink
--- Prabu [EMAIL PROTECTED] wrote: Hello, Hope this is your need... #!/usr/bin/perl -w use warnings ; use CGI qw/:standard/; print header, start_html(Stsd ILO Links), h1(Stsd ILO Links) ; print table({-border=undef,,-width='75%', -height='70%'}, caption(strong('Web Page Under construction?')), Tr({-align=CENTER,-valign=TOP}, [ th(['','A HREF=#Network Switch/A','A HREF=#Bay 1/A','A HREF=#Bay 2/A','A HREF=#Bay 3/A' ,'A HREF=#Network Switch/A' ]), th('A HREF=#Enclosure 1/A').td(['A HREF=#Bl20p G2/A','A HREF=#yes/A','A HREF=#yes/A']), th('A HREF=#Enclosure 2/A').td(['A HREF=#no/A','A HREF=#no/A','A HREF=#yes/A']) ] ) ); end_html(); Hi all, How to convert the format above into an OOP style when adding a hyperlink? I am afraid many people might have typo if they follow the format above. Thank you, Li __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Trying to add hyperlink
On Thu, June 22, 2006 09:25, chen li wrote: --- Prabu [EMAIL PROTECTED] wrote: Hello, Hope this is your need... #!/usr/bin/perl -w use warnings ; use CGI qw/:standard/; print header, start_html(Stsd ILO Links), h1(Stsd ILO Links) ; print table({-border=undef,,-width='75%', -height='70%'}, caption(strong('Web Page Under construction?')), Tr({-align=CENTER,-valign=TOP}, [ th(['','A HREF=#Network Switch/A','A HREF=#Bay 1/A','A HREF=#Bay 2/A','A HREF=#Bay 3/A' ,'A HREF=#Network Switch/A' ]), th('A HREF=#Enclosure 1/A').td(['A HREF=#Bl20p G2/A','A HREF=#yes/A','A HREF=#yes/A']), th('A HREF=#Enclosure 2/A').td(['A HREF=#no/A','A HREF=#no/A','A HREF=#yes/A']) ] ) ); end_html(); Hi all, How to convert the format above into an OOP style when adding a hyperlink? I am afraid many people might have typo if they follow the format above. THis might help: http://search.cpan.org/src/LDS/CGI.pm-3.08/cgi_docs.html -- Scott -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Trying to add hyperlink
chen li wrote: : How to convert the format above into an OOP style when : adding a hyperlink? I am afraid many people might : have typo if they follow the format above. First, let's fix a few things with this implementation. Use the -w or the warnings pragma, not both. The preference is for the pragma. Read pererllexwarn in the docs for details. Always use strict. : #!/usr/bin/perl -w : use warnings; #!/usr/bin/perl use strict; use warnings; : use CGI qw/:standard/; : print header, start_html(Stsd ILO Links), h1(Stsd ILO Links); : : print table({-border=undef,,-width='75%', -height='70%'}, Under xhtml there is no height attribute for tables, you are required to present a summary and 'border' cannot be undef under CGI.pm. You also have an extra comma up there, though I don't think it hurts anything. print header(), start_html( 'Stsd ILO Links' ), h1( 'Stsd ILO Links' ), table( { -border = 0, -width = '75%', -summary = 'Table of Enclosure features', }, : caption(strong('Web Page Under construction?')), : Tr({-align=CENTER,-valign=TOP}, Under 'use strict', CENTER and TOP are illegal barewords. Put them in quotes. Valid xhtml requires 'center' and 'top' (no capitilization). Tr( { -align = 'center', -valign = 'top' }, : [ :th(['','Network Switch','Bay 1','Bay 2','Bay 3' ,'Network Switch' ]), :th('Enclosure 1').td(['Bl20p G2','yes','yes']), :th('Enclosure 2').td(['no','no','yes']) th( 'Enclosure 1' ) . td( [ a( { -href = '/' }, 'Bl20p G2' ), a( { -href = '/' }, 'yes' ), a( { -href = '/' }, 'yes' ), ] ), th( 'Enclosure 2' ) . td( [ a( { -href = '/' }, 'no' ), a( { -href = '/' }, 'no' ), a( { -href = '/' }, 'yes' ), ] ), : ] : ) : ); Use a comma here instead of a semicolon or add a print statement to the next line. As Prabu already mentioned, you need to add an anchor to each box you want to link from. There's no easy way around it. We could use a subroutines to eliminated some typing. use strict; use warnings; use CGI qw/:standard/; print header(), start_html( 'Stsd ILO Links' ), h1( 'Stsd ILO Links' ), table( { -border = 0, -width = '75%', -summary = 'Table of Enclosure features', }, caption( strong( 'Web Page Under construction?' ) ), Tr( { -align = 'center', -valign = 'top' }, [ th( [ '', 'Network Switch', 'Bay 1', 'Bay 2', 'Bay 3', 'Network Switch' ] ), row( 'Enclosure 1', '/' = 'Bl20p G2', '/' = 'yes', '/' = 'yes', ), row( 'Enclosure 2', '/' = 'no', '/' = 'no', '/' = 'yes', ), ] ) ), end_html(); sub row { my $name = shift; return th( 'Enclosure 2' ) . td( anchors( @_ ) ); } sub anchors { my @anchors = @_; my @return; while ( @anchors ) { push @return, a( { -href = shift @anchors }, shift @anchors ), } return [EMAIL PROTECTED]; } __END__ In OO style. use strict; use warnings; use CGI; my $q = CGI-new(); print $q-header(), $q-start_html( 'Stsd ILO Links' ), $q-h1( 'Stsd ILO Links' ), $q-table( { -border = 0, -width = '75%', -summary = 'Table of Enclosure features', }, $q-caption( $q-strong( 'Web Page Under construction?' ) ), $q-Tr( { -align = 'center', -valign = 'top' }, [ $q-th( [ '', 'Network Switch', 'Bay 1',
Trying to add hyperlink
Hi, I was trying to add a hyperlink to each of the boxes but it was not putting it in the right place.Can anyone help me in this regard ? #!/usr/bin/perl -w use warnings ; use CGI qw/:standard/; print header, start_html(Stsd ILO Links), h1(Stsd ILO Links) ; print table({-border=undef,,-width='75%', -height='70%'}, caption(strong('Web Page Under construction?')), Tr({-align=CENTER,-valign=TOP}, [ th(['','Network Switch','Bay 1','Bay 2','Bay 3' ,'Network Switch' ]), th('Enclosure 1').td(['Bl20p G2','yes','yes']), th('Enclosure 2').td(['no','no','yes']) ] ) ); end_html(); Also can anyone point me the links for Perl CGI tutorials with emphasis on handling tables and forms. Thanx, Alok. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response