perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ville Jungman" <ville_jung...@hotmail.com>
Subject Re: output table with variable data
Date Wed, 19 Feb 2003 20:01:05 GMT
i'm not sure if You already got good solutions for Your problem but i think 
You could call the sub with [- ... -]; like this:
[- interface_list (@interfacelist); -]

...when the sub is like this (notice it's done without using print-command - 
i think it might(?) mess your things up or at least it _might_ be better to 
use 'print OUT' instead of 'print'):
[$ sub interface_list (@interfacelist) $]
     ...
     <td>[+ $interfacelist[0] +]</td>
     ...
[$ endsub $]

or even easier (more perl-ish) if You have embperl 2.??:
[* sub interface_list (@interfacelist){ *]
     ...
     <td>[+ $interfacelist[0] +]</td>
     ...
[* } *]

ville jungman, ulvilantie 3 b 11, 00350 helsinki, finland
tel. + 358 - 9 - 225 4482 , http://www.kolumbus.fi/vilmak
usko Herraan Jeesukseen, niin sinš pelastut. (apt. 16:31)




>From: "Alexander Hartmaier" <Alexander.Hartmaier@t-systems.at>
>To: <embperl@perl.apache.org>
>Subject: output table with variable data
>Date: Wed, 19 Feb 2003 14:45:01 +0100
>
>
>
>Hi list!
>
>I have to output a html table in some of my embperl pages which always 
>looks the
>same but the data is slightly different.
>My approch was to write a small sub which takes the array with the data and
>looks like this:
>
>----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>sub interface_list (@interfacelist)
>{
>   print ("
>   <tr class=heading>
>     <td>Mon</td>
>     <td>Device</td>
>     <td>Interface</td>
>     <td>Speed</td>
>     <td>Line</td>
>   </tr>
>   ");
>   for $indx ( 0 .. $#interfacelist )
>   {
>     print ("
>     <tr class=light>
>       <td class= $interfacelist[$indx][0] ><a> $interfacelist[$indx][1]
></a></td>
>       <td><a href='view-device.epl?id_device=$interfacelist[$indx][2] '>
>$interfacelist[$indx][3] </a></td>
>       <td><a href='view-interface.epl?id_interface= 
>$interfacelist[$indx][4] '>
>$interfacelist[$indx][5] </a></td>
>       <td><a href='view-line.epl?id_line= $interfacelist[$indx][6] '>
>$interfacelist[$indx][7] </a></td>
>     </tr>
>     ");
>   };
>}
>----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>My problem is that when I call the sub with '[+ interface_list 
>(@interfacegrp)
>+]' the lines are appended to the end of the output instead of the line 
>where I
>call it!
>Furthermore the array @interfacelist is empty...
>
>I think there is a better way to handle this problem!
>Gerald or anybody else has an idea?
>
>THX Alex
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
>For additional commands, e-mail: embperl-help@perl.apache.org


_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message