Although there are workarounds in place that do the job, this would make code a lot simpler.
I'm asking for a method of generating random numbers - with a new number generated every minute just in the same way that the ListPages module generates a new list of pages every minute when the order="random" option is used.
Currently, if I want to randomly change what appears in a specific part of my page I need to create a new page for every possible thing I want to display, and then use the ListPages module to randomly show one of them.
If all I want to do is to show a random image, then this isn't very efficient! It would be better if I could upload all images to the same page and use a random number generator such as I am proposing to select the image that is shown.
For example:
[[image http://site.wikidot.com/local--files/start/img%%random{4}%%.png]]
That would show either img1.png, img2.png, img3.png or img4.png — all attached to the same page.
Benefits:
- Using less "back end" pages, meaning cleaner search results — if you wanted to select from a random 20 pages, then those 20 pages aren't meant to be looked at by users directly, but they will still appear in search results! :(
- Easier to manage - just upload/rename/delete files from one page
- Works the way new users would probably expect it to, if they've had any existing programming experience
- If used in the CountPages module body, %%total%% can be used instead of a number to automatically extend the range when new pages are added
If this is reasonably simple to do, then please accept the wish! If it will take some time, then it's probably best to reject it.
The only thing I would add is that there should also be a way to format the number. My use case would be to add leading zeros to the random number (to handle img001.png, img002.png, img003.png or img004.png).
Community Admin
Well you can create 1000 empty pages with names 000, 001, 002, 003 and so on and use:
No easy way to pass the range though :-(. It could be done by smartly tagging the pages, but it'll cross the tag number limit quickly.
Piotr Gabryjeluk
visit my blog
There's a tag number limit? :O
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server | NEW: Wikiroo, made for Wikidot users (available early 2023)