[ic] create usertag

Jeannie Stevenson webteam at wes-state.com
Tue Jul 13 15:03:20 EDT 2004


Hello list

I'm trying to create a usertag to simplify some routines. The usertag is a
counter for a selected page and would be called via the tag
Each month is automatically incremented when a hit is made

the file should look like

hits to /ep,444,333,666,777,0,0,0,0,0,0,0,0
hits to /fram,333,444,666,0,0,0,0,0,0,0,0,0
etc...

The file consist of

$nameb,$hitsb1,$hitsb2,$hitsb3,$hitsb4,$hitsb5,$hitsb6,$hitsb7,$hitsb8,$hits
b9,$hitsb10,$hitsb11,$hitsb12

and is placed in etc/page_counter.txt




The usertag that I'm having trouble creating is...

Usertag page-counter Order tracking_file description
Usertag page-counter AddAttr
Usertag page-counter Routine <<EOR
sub {
my ($tracking_file $description) = @_;

$date = scalar localtime(time);
@months =
("Jan","Feb","Mar","Apr","May","Jun","Jly","Aug","Spt","Oct","Nov","Dec");
@days =
("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sun
day","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
($sec,$min,$hr,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$min = sprintf("%02d",$min);

$year=$year+1900;
$yr=substr($year,2,2);
$month=$mon+1;
$todaysdate = sprintf("%02d/%02d/%02d",$month,$mday,$yr);
$inq_month = sprintf("%02d",$month);
$inq_date = sprintf("%02d/%02d/%02d",$month,$mday,$yr);

}

&update_hits;

sub update_hits {

open(CIN,"$tracking_file") || die "Can't find database.\n";
@cnum=<CIN>;
close(CIN);

open(TFILES,">$tracking_file") || die "Can't find database.\n";

   foreach $i (@cnum) {
   chomp($i);

($nameb,$hitsb1,$hitsb2,$hitsb3,$hitsb4,$hitsb5,$hitsb6,$hitsb7,$hitsb8,$hit
sb9,$hitsb10,$hitsb11,$hitsb12) = split(/\|/,$i);

   if ($nameb eq "$description") {

      if ($inq_month eq "01") {
      $hitsb1++;
      }

      if ($inq_month eq "02") {
      $hitsb2++;
      }

      if ($inq_month eq "03") {
      $hitsb3++;
      }

      if ($inq_month eq "04") {
      $hitsb4++;
      }

      if ($inq_month eq "05") {
      $hitsb5++;
      }

      if ($inq_month eq "06") {
      $hitsb6++;
      }

      if ($inq_month eq "07") {
      $hitsb7++;
      }

      if ($inq_month eq "08") {
      $hitsb8++;
      }

      if ($inq_month eq "09") {
      $hitsb9++;
      }

      if ($inq_month eq "10") {
      $hitsb10++;
      }

      if ($inq_month eq "11") {
      $hitsb11++;
      }

      if ($inq_month eq "12") {
      $hitsb12++;
      }

   print TFILES
"$nameb|$hitsb1|$hitsb2|$hitsb3|$hitsb4|$hitsb5|$hitsb6|$hitsb7|$hitsb8|$hit
sb9|$hitsb10|$hitsb11|$hitsb12\n";
    }#end
 }
 }
EOR


If anyone has any idea of better routines comments are welcome

When I finished I think this could be a welcome addition to the IC
development core


Thanks

Jeannie




More information about the interchange-users mailing list