LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG-Webdev] Perl: counter for three columns

[ILUG-Webdev] Perl: counter for three columns

adam beecher lists at beecher.net
Thu Dec 11 15:36:20 GMT 2003


I'm tooling around a little with the AmphetaDesk RSS reader however my
Perl's a bit rusty. At the moment the feeds are split into two columns,
using this perl:

# Hack to create two columns. Nasty perl but it's been a while.
my $count = $#channels + 1;
my $half = int($count / 2) + 1;
my $counter = 0;

# Open the table
to_browser(qq{ <br /><table width="100%"><tr valign="top"><td
width="50%"> });

# for each channel, parse and display.
foreach my $channel (@channels) {
    $counter = $counter + 1;
    if ( $counter == $half ) {
        to_browser(qq{ </td><td width="50%"> });
    }


I'd like to change this to use three columns, which I guess I could do by
dividing by three and adding one like yerman does above (doesn't perl have a
modulus operator?), and then multiplying by two and yadda yadda, but I'd
like to make a $columns var that I can adjust. Any hints for me?

adam


<?php
$s=array(74,65,112,104,112,72,32,59,45,41);
for($i=0;$i<count($s);$i++){echo'&#'.$s[$i].';';}
?>




More information about the Webdev mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell