in reply to Empty table row
For example, what does substemplate() do?
As a guess, I'd say you should to reorganize your code into a loop, and test the strings before calling substemplate(); here's an untested example of what that might look like:
my $templ=opentemplate('regform','normal'); substemplate($templ,'fullname',$arr[0]); substemplate($templ,'header',$arr[3]); # $link0="<a href=http://$arr[2]>$arr[1]</a>"; substemplate($templ,'link0',$link0); # foreach my $linknum ( 1 .. 10 ) { my $pos = $linknum * 2 + 2; my ( $text, $url ) = @arr[ $pos, $pos + 1 ]; my $link = ( ! $text or ! $url ) ? '' : "<tr><td><a href=http://$url>$text</a><br><br></tr></td>"; substemplate($templ,"link$linknum",$link); } substemplate($templ,'refer',$refer?$refer:'none'); print $templ;
|
|---|