*

alex7070

  • ****
  • 132 posts
Is it possible for the ad to indicate the number of views?
« on: April 07, 2021, 09:37:27 AM »
Hi! Is it possible for the ad to indicate the number of views? Thanks

Marked as best answer by frosticek on April 07, 2021, 07:05:33 PM
*

MB Themes

Re: Is it possible for the ad to indicate the number of views?
« Reply #1 on: April 07, 2021, 09:55:16 AM »
@alex7070
It's good practice to first check docs & existing topics on forums.
https://docs.osclasspoint.com/hitems-php

osc_item_views() – return number of views of current item

  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

alex7070

  • ****
  • 132 posts
Re: Is it possible for the ad to indicate the number of views?
« Reply #2 on: April 07, 2021, 12:01:11 PM »
Thanks! Should I insert this line into that file or should I uncomment something in this file? I'm not a programmer unfortunately.
« Last Edit: April 07, 2021, 12:30:26 PM by alex7070 »

*

MB Themes

Re: Is it possible for the ad to indicate the number of views?
« Reply #3 on: April 07, 2021, 04:39:33 PM »
@alex7070
In case you have no clue about PHP, do not do it, you will break more than you will do.
I've sent you link to documentation for helper functions as well as funciton you were asking about itself.

Following code will print/echo how many times was listing viewed.
Code: [Select]
<?php echo osc_item_views(); ?>
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

alex7070

  • ****
  • 132 posts
Re: Is it possible for the ad to indicate the number of views?
« Reply #4 on: April 07, 2021, 04:49:09 PM »
Thanks! In which file should this code be inserted? hItems.php   ?



If I break something, I can put it back.

*

MB Themes

Re: Is it possible for the ad to indicate the number of views?
« Reply #5 on: April 07, 2021, 04:50:40 PM »
@alex7070
Well, in theme files.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

alex7070

  • ****
  • 132 posts
Re: Is it possible for the ad to indicate the number of views?
« Reply #6 on: April 07, 2021, 04:56:37 PM »
In theme file item.php , yes? Thanks

*

MB Themes

Re: Is it possible for the ad to indicate the number of views?
« Reply #7 on: April 07, 2021, 05:01:40 PM »
Correct.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

alex7070

  • ****
  • 132 posts
Re: Is it possible for the ad to indicate the number of views?
« Reply #8 on: April 07, 2021, 05:13:07 PM »
It works, thanks. A digit is shown.

How to make the word "views" next to this number in the selected language from the language file?

*

MB Themes

Re: Is it possible for the ad to indicate the number of views?
« Reply #9 on: April 07, 2021, 06:30:39 PM »
You may check translationa documentation or check how it is made in theme with other words.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

alex7070

  • ****
  • 132 posts
Re: Is it possible for the ad to indicate the number of views?
« Reply #10 on: April 07, 2021, 06:32:47 PM »
OK, thanks!

*

alex7070

  • ****
  • 132 posts
Re: Is it possible for the ad to indicate the number of views?
« Reply #11 on: April 07, 2021, 09:46:50 PM »
I see this feature on almost every bulletin board (not osclass). It would be nice if this was already built into the osclass core. But you know better.

*

MB Themes

Re: Is it possible for the ad to indicate the number of views?
« Reply #12 on: April 08, 2021, 07:55:56 AM »
@alex7070
It is in osclass core, you've used function from there :)
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

alex7070

  • ****
  • 132 posts
Re: Is it possible for the ad to indicate the number of views?
« Reply #13 on: April 08, 2021, 08:08:22 AM »
I meant that this function could be enabled through the administration panel :)

*

MB Themes

Re: Is it possible for the ad to indicate the number of views?
« Reply #14 on: April 08, 2021, 08:49:15 AM »
@alex7070
It usually depends on theme, if it is or is not integrated.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots