
mike at perusion
Jul 22, 2013, 12:03 PM
Post #4 of 4
(52 views)
Permalink
|
Quoting Mike Heins (mike [at] perusion): > Quoting Iserv-appbox (ibox23 [at] iserv): > > Hi, > > > > I'm looking for a "View-Counter" UserTag in Interchange. > > > > We are in the process of tranferring our website to Interchange. > > I'm stumbling over an issue however. > > > > For our current website I programmed a simple perl script "counter.cgi" > > that writes the IP address of the visitor to a log file each time it is invoked. > > Via an <!--#include virtual=..--> we include this script into the page that we want to monitor. > > > > In Interchange I can't find a comparable UserTag however. > > I searched the Interchange coretags, UI, standard demo, CPAN, but no luck. > > It seems there is no "central repository" of Interchange UserTag contributions. > > > > Before I start coding myself.. > > Did anyone make such a UserTag? > > > > <!-- [log file="logs/hits/@@MV_PAGE@@" create=1 interpolate=1][data session ohost] [time fmt="%Y-%m-%d %H:%M:%S][/log] --> Actually, besides missing a quote, that won't work unless the file already exists. Creating such a thing is pretty easy: UserTag log-hits Routine <<EOR sub { my $page = $Tag->var('MV_PAGE', 1); my $fn = "logs/hits/$page"; my $data = join "\t", $Session->{host}, $Tag->time({ fmt => '%Y-%m-%d %H:%M:%S'}); if(-f $fn) { $Tag->log( { file => $fn }, $data); } else { $data .= "\n"; $Tag->write_relative_file( { file => $fn }, $data); } return; } EOR Now you just need [log-hits] in any page, and away you go. -- Mike Heins Perusion -- Expert Interchange Consulting http://www.perusion.com/ phone +1.765.253.4194 <mike [at] perusion> {((>:o}~ <<<<Oh look!!! An idolatrous image of the prophet!!! Surely we must now avenge this blasphemy by burning down the world!!! _______________________________________________ interchange-users mailing list interchange-users [at] icdevgroup http://www.icdevgroup.org/mailman/listinfo/interchange-users
|