Jump to content

how to get page viewed times?


KangLing
 Share

Recommended Posts

This is one way - I got this from someone in the forum (can't remember who, sorry).

Create an integer field called 'views' and add it to your template along with this code in your template file. You can then add that field to visible in your page list: under the Advanced tab in your template.

<?php
if($user->isGuest()) {
    // Count page views only if guest
    $page->views += 1;
    $page->of(false);
    $page->save('views');
    $page->of(true);
}
?>

  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...