logo
Home XtGem- Templates- XtScript- bottom
non repeating random image with rating widget
Advanced users
Cookies and Xtcat.xtgem.com registration are required
The Xtcat widget must be installed from the xtgem market page and the rating widget enabled on your xtcat profile
* Xtcat
Total entries in /my_images = 29
Generated new cookie
.26.23.12.18.3.10.15.17.4.21.14.2.24.8.19.5.7.22.16.9.6.29.11.1.25.13.28.27.20.29
First value = 26
Entry #26 is skull.png
New cookie
.23.12.18.3.10.15.17.4.21.14.2.24.8.19.5.7.22.16.9.6.29.11.1.25.13.28.27.20.26.29
nextreset

skull

skull.png
Image Rating:
star star star
3 Out Of 5
Votes: 12
Your Rating:
Note:
The styling of this example is part of my sites stylesheet and is not included in the script
All the styling can be customized in the area of the script under the heading # output
First the script creates a cookie containing a non-repeating random sequence between 1 and the total number of files in the folder
The last number is a check value of the number of files in the folder so that if you add more files the cookie will reset
although it may take some time for the cache to refresh and include the new images

When the page loads the first number in the cookie is read and then placed at the end (before the check value) and the cookie is refreshed

NOTE
if the folder is very large the script may time out while creating the random sequence I tested the bare script with up to 1100 entries
but the limit may be about 500 for the full script depending on if you have any other xtscripts running on the page
Xtscript
Rating widget blank classes
Powered by XtGem
About us Contact Forum top