Hi,
Your aproaching is confusing and don't use the features Embperl provide
you :)
Use Embperl [$ subs $] when you need to output data and when it is not
possible use print OUT inside your subs to print data in the
correct place;
About CGI.pm, you dont't need it when using Embperl.
Try to use the Embperl idioms:
<table>
[$ foreach $var @list $]
<tr><td>...</td></tr>
[$ endforeach $]
</table>
you can use [$ if test $] around your foreach to have conditional loops
also. I suggest you take a look at the man page of Embperl and
EmbperlObject to get familiar with the syntax if are new to Embperl.
Regards,
Luiz Fernando B. Ribeiro
Engenho Solu��es para a Internet
Em Wed, 19 Feb 2003 14:45:01 +0100
"Alexander Hartmaier" <[EMAIL PROTECTED]> escreveu:
>
>
> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]