[ic] Thanks; Re: View-Counter UserTag?

Marjan Waldorp ibox23 at iserv.xs4all.nl
Tue Jul 23 15:35:08 UTC 2013


Hi Mike,

Many thanks for your answer!

Your help will save me a lot of time.

Kind regards,

Marjan Waldorp,
Tux4u.nl

======================================
On 2013-07-22 21:03, Mike Heins wrote:
> Quoting Mike Heins (mike at perusion.com):
>> Quoting Iserv-appbox (ibox23 at iserv.xs4all.nl):
>>> 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/@@[email protected]@" 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.
>



More information about the interchange-users mailing list