Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: DBIx_XHTML_Table usage - Urgent Please

by Samy_rio (Vicar)
on Nov 21, 2006 at 05:18 UTC ( #585197=note: print w/ replies, xml ) Need Help??


in reply to DBIx_XHTML_Table usage - Urgent Please

Hi, your code looks good. Its working fine for me with hyperlink. In DBIx::XHTML_Table module, all the column names are in same case (lower or upper) as of database field name.

Look the code:

use DBIx::XHTML_Table; # database credentials - fill in the blanks my ($data_source,$usr,$pass) = (); my $table = DBIx::XHTML_Table->new('DBI:mysql:project', '', ''); $table->exec_query("select * from test"); $table->modify(table => { width => '100%', cellspacing=> '2', cellpadding=>'5', 'border-style' => 'inset', 'border-width' => 'thin', }); $table->modify(th => { style => { color => '#FFFAF0', background => '#4682B4', 'text-align' => 'center', 'text-transform'=> 'uppercase', } },'head'); $table->modify(tr => { style => { background => ['#B0C4DE','#F0F8FF'], } }); $table->modify(td => { style => { 'text-align' => 'left', 'white-space' => 'nowrap', } }); $table->modify(td => { style => { 'text-align' => 'center', 'white-space' => 'nowrap', } },['id']); $table->modify(th => { style => 'background: #FFF0F5' },'id'); $table->map_cell( sub{ my $datum = shift; return qq|<a href="http://sctesrv.india/cgi/project/viewpro +jectdetail.cgi?projectid=P-$datum">"$datum"</a>|; }, ['id']); print $table->output;
Output as: <table width="100%" cellspacing="2" cellpadding="5" border-width="thin +" border-style="inset"> <thead> <tr style="background: #B0C4DE;"> <th style="background: #FFF0F5">Id</th> <th style="text-align: center; text-transform: uppercase; colo +r: #FFFAF0; background: #4682B4;">Value</th> </tr> </thead> <tbody> <tr style="background: #F0F8FF;"> <td style="text-align: center; white-space: nowrap;"><a href=" +http://sctesrv.india/cgi/project/viewprojectdetail.cgi?projectid=P-1" +>"1"</a></td> <td style="text-align: left; white-space: nowrap;">hello</td> </tr> <tr style="background: #B0C4DE;"> <td style="text-align: center; white-space: nowrap;"><a href=" +http://sctesrv.india/cgi/project/viewprojectdetail.cgi?projectid=P-2" +>"2"</a></td> <td style="text-align: left; white-space: nowrap;">googbye</td +> </tr> <tr style="background: #F0F8FF;"> <td style="text-align: center; white-space: nowrap;"><a href=" +http://sctesrv.india/cgi/project/viewprojectdetail.cgi?projectid=P-3" +>"3"</a></td> <td style="text-align: left; white-space: nowrap;">friend</td> </tr> </tbody> </table>

Regards,
Velusamy R.


eval"print uc\"\\c$_\""for split'','j)@,/6%@0%2,`e@3!-9v2)/@|6%,53!-9@2~j';


Comment on Re: DBIx_XHTML_Table usage - Urgent Please
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://585197]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (17)
As of 2015-07-01 19:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (17 votes), past polls