jDownloadsownloads.com
Advertisement
 

Author Topic: is there a random feed for jD?  (Read 1289 times)

0 Members and 1 Guest are viewing this topic.

Offline wacl3

  • Jr. Member
  • **
  • Posts: 64
is there a random feed for jD?
« on: 17.05.2021 12:02:55 »
Hi, I have a page in my JDownloads website showing the latest items/downloads added feed.... Is there a way I can show this feed in a random order?
thanks

Offline Arno

  • Administrator
  • ***
  • Posts: 12.400
    • jDownloads.com
Re: is there a random feed for jD?
« Reply #1 on: 18.05.2021 15:12:41 »
Hi,
please post a pic. I do not understand what you mean exactly. The view which you mean is a module from jDownloads?
Best Regards / Gruß
Arno
Please make a Donation for jDownloads and/or write a review on the Joomla! Extensions directory!

Offline Tazzios

  • Jr. Member
  • **
  • Posts: 71
    • Jdownloads pdfviewer
Re: is there a random feed for jD?
« Reply #2 on: 24.05.2021 10:30:47 »
Hi, I have a page in my JDownloads website showing the latest items/downloads added feed.... Is there a way I can show this feed in a random order?
thanks
I assume that you use/ment a module? There is currently no randomize option in nay of the modules. But a randomize option for latest also seems a bit weird.
Second is how should it work?  select the 5 latest and randomize those or select the 20 latest, randomize those and only show 5.

Offline Tazzios

  • Jr. Member
  • **
  • Posts: 71
    • Jdownloads pdfviewer
Re: is there a random feed for jD?
« Reply #3 on: 24.05.2021 19:02:11 »
With some ideas and some spare time on hand I start creating a new module that can replace:
Top
Latest
Last_updated
Rating.
Which could save time on maintenance. For example I saw that the rating module build an own query but that is not necessary, downloads.php model works just fine.

Additional is also has a:
random function.
Different sort options ( like in the related module )

Todo is the template which is currently based on Top. It seems like they all are kind of the same but don`t know or i can merge it easily.
Other thing is the translation files. Maybe i can build a release next weekend.

@Arno is it OK that i create this module?
« Last Edit: 24.05.2021 19:04:27 by Tazzios »

Offline ColinM

  • Moderator
  • *
  • Posts: 4.157
Re: is there a random feed for jD?
« Reply #4 on: 25.05.2021 13:00:22 »
Tazzios,Most of the modules have had an update in the forthcoming jD 3.9.8 release.  They now use a <div> rather than a <table> basis.  Also you can select if the file images have links in them.  Both of these are for WCAG compliance.  Have also added a modules CSS file for customising.
Whilst combining modules would reduce code volume overall it does add a degree of complexity but because the code is similar in most modules it is generally simple to find a bug and then fix each one individually.  Also having them individually would make it more challenging for many users.
Also Arno is concentrating on Joomla 4 and wants to minimise the number of changes at this time.

So now is not a good time!  But what might be a good idea when settlerd in V4 is a library of the common functions in the modules.  Such a scheme would reduce code and keep the simplicity of individual modules.
ColinPS a Random module is on my list!!  But using the Download IDs directly is not sufficient as it skews the probability distribution when some Downloads have been deleted. So for correct operation it needs an array of IDs and then to generate a scaled random number to select which entry to use in the array.  Such an array exist of course in the jD files table where one would select the Kth entry where K is the scaled random number using the the number rows in the files table with the COUNT function

Offline Tazzios

  • Jr. Member
  • **
  • Posts: 71
    • Jdownloads pdfviewer
Re: is there a random feed for jD?
« Reply #5 on: 25.05.2021 15:06:29 »
Tazzios,Most of the modules have had an update in the forthcoming jD 3.9.8 release.  They now use a <div> rather than a <table> basis.  Also you can select if the file images have links in them.  Both of these are for WCAG compliance.  Have also added a modules CSS file for customising.
Whilst combining modules would reduce code volume overall it does add a degree of complexity but because the code is similar in most modules it is generally simple to find a bug and then fix each one individually.  Also having them individually would make it more challenging for many users.
Also Arno is concentrating on Joomla 4 and wants to minimise the number of changes at this time.
Great, the styling is something i`m not familiar with. :)

Quote
So now is not a good time!  But what might be a good idea when settlerd in V4 is a library of the common functions in the modules.  Such a scheme would reduce code and keep the simplicity of individual modules.
ColinPS a Random module is on my list!!  But using the Download IDs directly is not sufficient as it skews the probability distribution when some Downloads have been deleted. So for correct operation it needs an array of IDs and then to generate a scaled random number to select which entry to use in the array.  Such an array exist of course in the jD files table where one would select the Kth entry where K is the scaled random number using the the number rows in the files table with the COUNT function
Not a new module! :P In combination with other module(s) it would be more power full. For example if you have uploaded 20 new files and the module only show 5 it would be nice if it would randomize the 20 new files.

In my code i solved it as following: choose which top list you want (hits,new,rated,updated) select how many you want to retrieve(20). If you choose 'random' at the order dropdown you get an extra field where you can insert how many you want to show(5). What is happening in the code is: retrieve rows from DB(20), shuffles the array, delete rows from array till you have x(5) rows left.
I do not have a total random function but you can insert 10000000 instead of 20 to make it totally random. :)

you can see the module on my testsite which i send earlier. module name "jDownloads Top 2.0 rebuild" shown on the page "modulesjdown". I Only edited the helper and xml so far. I can send you the code if you like.
Maybe i can continue after the 3.9.8 release?

Offline ColinM

  • Moderator
  • *
  • Posts: 4.157
Re: is there a random feed for jD?
« Reply #6 on: 26.05.2021 14:13:19 »
Hi
 Ihad assumed a new module as it had been asked for previouslyBasically not the time for any changes whilst working on v4Colin

Offline Tazzios

  • Jr. Member
  • **
  • Posts: 71
    • Jdownloads pdfviewer
Re: is there a random feed for jD?
« Reply #7 on: 04.06.2021 16:23:26 »
I published my changes for the top module on github:
https://github.com/Tazzios/Jdownloads_Top_module/tree/Top-module-2.0

If you want to try it copy the files to '/modules/mod_jdownloads_top' this will overwrite the existing top module.  NOTE: It  will be overwritten  when you update jdownloads.

Offline Tazzios

  • Jr. Member
  • **
  • Posts: 71
    • Jdownloads pdfviewer
Re: is there a random feed for jD?
« Reply #8 on: 03.10.2021 16:52:36 »
I merged the css version of the TOP modules
https://github.com/Tazzios/Jdownloads_Top_module/tree/Top-module-2.0

Benefits compared to normal top module:
It can be used instead of Top,Latest,Last_updated,Rating. So no need of figuring out which module you need for your top list.

More inportant is also has a:
randomize top x function.
Different sort options ( like in the related module which i modified earlier)

Example as attachment:
Top 10 rated downloads with minimum rating of 3 order by most downloaded