SimplePortal

Customization => Themes and Graphics => Topic started by: Inti31 on August 08, 2011, 05:41:23 AM

Title: Count views on pages?
Post by: Inti31 on August 08, 2011, 05:41:23 AM
Simpleportal works perfect for me.
Now I implemented my first page - everything is fine.

http://epica-forum.de/index.php?page=pg_gaestebuch


Now my question.
At the top you see the headline "Gästebuch" (=guestbook)
is it now possible to add a "counter" (=read x times) next to that to show how many times this page has been visited / viewed  like a normal smf topic ?

Example: "guestbook (read x times)"

cheers inti31
Title: Re: Count views on pages?
Post by: AngelinaBelle on August 08, 2011, 09:31:05 AM
SimplePortal does not offer a way to do this. It would need a count field added to the database, plus a function call to update that whenever it is viewed. This would be a custom coding project.
I'm going to move this to custom coding, where I hope it will capture the attention of our friendly customizers here at SimplePortal.net
Title: Re: Count views on pages?
Post by: grafitus on August 08, 2011, 04:58:14 PM
./Themes/default/PortalPages.template.php

There are two instances of the code, you need to replace them both to see on two main themes -- Core and Curve:
Code: (Find) [Select]
', $context['SPortal']['page']['title'], '
Code: (Replace) [Select]
', $context['SPortal']['page']['title'], ' (', $txt['read'], ' ', $context['SPortal']['page']['views'], ' ', $txt['times'], ')
Title: Re: Count views on pages?
Post by: Inti31 on August 08, 2011, 06:03:31 PM
grafitus ! Wow - it works! Thank you very much!


only one thing - which file do I have to modify to get the shown text in my favorite language?
It is shown in English instead of German - i use german-utf8.

thanks again

cheers inti31
Title: Re: Count views on pages?
Post by: grafitus on August 08, 2011, 08:34:58 PM
Sorry, I have edited the above; now, with language strings. :cool:
Title: Re: Count views on pages?
Post by: Inti31 on August 09, 2011, 08:47:43 AM
grafitus - it works as it should - very nice - thx again!

// biggrin -  ;D
SimplePortal does not offer a way to do this. It would need a count field added to the database, plus a function call to update that whenever it is viewed.
// biggrin -  ;D

@AngelinaBelle, AngelinaBelle, AngelinaBelle,...   ;)- to be honest - I expected more than just add a small string to the PortalPages.template.php when I first read your answer... -  this is all the more surprising that this could be done like grafitus has posted it :) - topic solved

cheers Inti31
Title: Re: Count views on pages?
Post by: AngelinaBelle on August 09, 2011, 08:55:03 AM
Yep.  That's because I missed the fact that it was already being counted.
I was wrong about that one -- the hard work was already done!
I'm glad it was so easy for you.
SimplePortal 2.3.8 © 2008-2024, SimplePortal