Osclass Support Forums
General osclass questions => General discussion => Topic started by: alex7070 on April 07, 2021, 09:37:27 AM
-
Hi! Is it possible for the ad to indicate the number of views? Thanks
-
@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
-
Thanks! Should I insert this line into that file or should I uncomment something in this file? I'm not a programmer unfortunately.
-
@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.
<?php echo osc_item_views(); ?>
-
Thanks! In which file should this code be inserted? hItems.php ?
If I break something, I can put it back.
-
@alex7070
Well, in theme files.
-
In theme file item.php , yes? Thanks
-
Correct.
-
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?
-
You may check translationa documentation or check how it is made in theme with other words.
-
OK, thanks!
-
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.
-
@alex7070
It is in osclass core, you've used function from there :)
-
I meant that this function could be enabled through the administration panel :)
-
@alex7070
It usually depends on theme, if it is or is not integrated.
-
It is possible to do this for example in the default theme Sigma. Are there any themes where this has already been implemented?
-
@alex7070
You can check any free theme, i.e. bender, it should have it, or tatiana as well.
-
OK, Thanks!