Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Interchange: users

Thanks; Re: View-Counter UserTag?

 

 

Interchange users RSS feed   Index | Next | Previous | View Threaded


ibox23 at iserv

Jul 23, 2013, 8:35 AM

Post #1 of 1 (37 views)
Permalink
Thanks; Re: View-Counter UserTag?

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):
>> 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.
>

_______________________________________________
interchange-users mailing list
interchange-users [at] icdevgroup
http://www.icdevgroup.org/mailman/listinfo/interchange-users

Interchange users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.