KangLing Posted April 2, 2015 Share Posted April 2, 2015 I need your help, how to get page viewed times? thank you! Link to comment Share on other sites More sharing options...
Marty Walker Posted April 2, 2015 Share Posted April 2, 2015 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); } ?> 3 Link to comment Share on other sites More sharing options...
adrian Posted April 2, 2015 Share Posted April 2, 2015 Hi @joineffort and welcome! Here's a great thread with some options: https://processwire.com/talk/topic/2868-count-views-of-post/ It's very easy! PS Marty beat me 1 Link to comment Share on other sites More sharing options...
KangLing Posted April 2, 2015 Author Share Posted April 2, 2015 thank you! i am new to processwire, i like this cms! 5 Link to comment Share on other sites More sharing options...
Marty Walker Posted April 2, 2015 Share Posted April 2, 2015 PS Marty beat me There's a first time for everything. 3 Link to comment Share on other sites More sharing options...
renobird Posted April 2, 2015 Share Posted April 2, 2015 Welcome joineffort. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now