#!/usr/bin/perl &main; sub main { # this is the path to your classifieds_data.pl $basepath = "/cgi-bin/suite/classifieds/websites/default/data"; # the url to your ads #$url = "http://www.runninghorses.net/cgi-bin/suite/classifieds/classifieds.cgi?request=detail&ad_id=$thebid[3]&website=default&session=$session"; $url = "http://www.runninghorses.net/cgi-bin/suite/classifieds/classifieds.cgi"; # the name of the file containing your classified data $file = "classifieds_data.pl" # set the counter to zero $counter=0; # how many ads should be displayed $maxshow=5; # the width of the table $width=75; # this changes the tablecolor in every row $i = 0; $odd_row_color="#FFFFFF"; $even_row_color="#e4e4e4"; # starting output print "Content-type: text/html\n\n"; print ""; print ""; srand(time); open DATAFILE, "$basepath/$file"; (@data) = ; close DATAFILE; chomp(@data); foreach $bid (@data) { @thebid = split(/\|/,$bid); if ($i % 2 == 1) { $colortablebody=$odd_row_color; } else { $colortablebody=$even_row_color; } if ($counter < $maxshow) { print ""; $i++; } #end if ($counter <= $maxshow) $counter++; } #end foreach $bid print"
Here are the last $maxshow Ads:
Classifieds
"; }