Osclass Support Forums

General osclass questions => General discussion => Topic started by: alex7070 on April 07, 2021, 09:37:27 AM

Title: Is it possible for the ad to indicate the number of views?
Post by: alex7070 on April 07, 2021, 09:37:27 AM
Hi! Is it possible for the ad to indicate the number of views? Thanks
Title: Re: Is it possible for the ad to indicate the number of views?
Post by: MB Themes 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

Title: Re: Is it possible for the ad to indicate the number of views?
Post by: alex7070 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.
Title: Re: Is it possible for the ad to indicate the number of views?
Post by: MB Themes 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(); ?>
Title: Re: Is it possible for the ad to indicate the number of views?
Post by: alex7070 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.
Title: Re: Is it possible for the ad to indicate the number of views?
Post by: MB Themes on April 07, 2021, 04:50:40 PM
@alex7070
Well, in theme files.
Title: Re: Is it possible for the ad to indicate the number of views?
Post by: alex7070 on April 07, 2021, 04:56:37 PM
In theme file item.php , yes? Thanks
Title: Re: Is it possible for the ad to indicate the number of views?
Post by: MB Themes on April 07, 2021, 05:01:40 PM
Correct.
Title: Re: Is it possible for the ad to indicate the number of views?
Post by: alex7070 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?
Title: Re: Is it possible for the ad to indicate the number of views?
Post by: MB Themes on April 07, 2021, 06:30:39 PM
You may check translationa documentation or check how it is made in theme with other words.
Title: Re: Is it possible for the ad to indicate the number of views?
Post by: alex7070 on April 07, 2021, 06:32:47 PM
OK, thanks!
Title: Re: Is it possible for the ad to indicate the number of views?
Post by: alex7070 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.
Title: Re: Is it possible for the ad to indicate the number of views?
Post by: MB Themes on April 08, 2021, 07:55:56 AM
@alex7070
It is in osclass core, you've used function from there :)
Title: Re: Is it possible for the ad to indicate the number of views?
Post by: alex7070 on April 08, 2021, 08:08:22 AM
I meant that this function could be enabled through the administration panel :)
Title: Re: Is it possible for the ad to indicate the number of views?
Post by: MB Themes on April 08, 2021, 08:49:15 AM
@alex7070
It usually depends on theme, if it is or is not integrated.
Title: Re: Is it possible for the ad to indicate the number of views?
Post by: alex7070 on April 08, 2021, 09:37:27 AM
It is possible to do this for example in the default theme Sigma. Are there any themes where this has already been implemented?
Title: Re: Is it possible for the ad to indicate the number of views?
Post by: MB Themes on April 08, 2021, 02:13:41 PM
@alex7070
You can check any free theme, i.e. bender, it should have it, or tatiana as well.
Title: Re: Is it possible for the ad to indicate the number of views?
Post by: alex7070 on April 08, 2021, 02:17:05 PM
OK, Thanks!