News:

Support for jDownloads 3 has been ended
Since 17 August 2023 Joomla.org has discontinued support for Joomla 3.x. Therefore, we will no longer offer official support for our Joomla 3 jDownloads version 3.9.x from January 2024.
Please update your website to the latest Joomla version (Joomla 4 or Joomla 5) as soon as possible. Afterwards, please update jDownloads to the latest published version. The longer you delay, the more difficult the upgrade process for your website is likely to be.

Main Menu
Support-Forum

is there a random feed for jD?

Started by wacl3, 17.05.2021 12:02:55

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

wacl3

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
  •  

Arno

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!
  •  

Tazzios

Quote from: wacl3 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
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.

Tazzios

#3
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?

ColinM

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
Colin M
  •  

Tazzios

Quote from: ColinM 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.
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?

ColinM

Hi
Ihad assumed a new module as it had been asked for previouslyBasically not the time for any changes whilst working on v4Colin
Colin M
  •  

Tazzios

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.

Tazzios

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