[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 220
  • Last Modified:

Display a web hit counter on a view

I used the following code to generate a hit counter:

FIELD CountDate := CountDate;
FIELD Counter := Counter;
count := @GetProfileField("WebCounter";"Counter";"Anonymous");
date := @Now;
@If(count="";@Do(@SetField("count";1);@SetProfileField("WebCounter";"CountDate";date;"Anonymous"));@SetField("count";count+1));
@SetProfileField("WebCounter";"Counter";count;"Anonymous");
@SetField("Counter";count);
@SetField("CountDate";@GetProfileField("WebCounter";"CountDate";"Anonymous"));

How can I display the counter on a view??
0
ccgarciam
Asked:
ccgarciam
1 Solution
 
scottrmaCommented:
Not sure if @GetProfileField works in views, but since it appears that you are also storing the counter value in the document (as well as the profile document), you could use the value from the document to display in the view. In your formula above, I believe this would simply be the field "count" or "Counter".

You could also have your view display as part of a $$ViewTemplateForViewname or $$ViewTemplateDefault form, which would allow you to place the value of the counter anywhere you want on the form.

Hope this helps.

Scott
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now