[- 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" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]