Lordeagle
The script below is what i used to display and show random files @ my homepage
http://eaglenet.xtgem.com study and edit to display random files if u need any help send me a private message(pm) or visit my forum
http://forum.eaglenet.xtgem.com <script>
var pg = "<xt:url/>"
if (pg == "http://eaglenet.xtgem.com/index"){
location.replace('http://eaglenet.xtgem.com/index?__filelist_page=<xt:random from="1" to="10" x="1"/>')};
</script>
Copy code
Aash
Lordeagle Its ok for limited files. But if we continously upload files, then we also must update this code again and again... The to=""
Lordeagle
Aash Yup just set the cold to the uploads maximum pages thats all
Aash
Lordeagle Its a nice script though! :thumbs:
Lordeagle
Aash Thanks dude I think xtgem paging script can be of help though might be useless when more filelist are used on the page. In the paging there is variable that generates the total available pages in the filelist just check the custom paging script u will see it.
Graham
This will also do it
Use filecount in a xtscript variable and divide it by the number per page and round it up to give you the total pages
then use that in the random function as a xtscript $$ get variable
<!--parser:xtscript-->
var $c=<xt:filecount folder="/myfolder" />
var $c=call ceil $num=($c/10)
<!--/parser:xtscript-->
<script>
var pg = "<xt:url/>"
if (pg == "http://eaglenet.xtgem.com/index"){
location.replace('http://eaglenet.xtgem.com/index?__filelist_page=<xt:random from="1" to="{_$$c|}" x="1"/>')};
</script>
Copy code
ps your original post had no space after your site url so everything else was being included in the url messing up the layout
Aash
Graham Oh, that's a good one, Thanks!
Lordeagle
Graham Alright thanks for the new code i really appreciate it.
Lordeagle
Lordeagle It can recoded to javascript to get a shorter code
<script>
var c= <xt:filecount folder="/myfolder" />;
num = (c % 10) "+" c/10; // when c is an odd num
var pg = "<xt:url/>";
if (pg == "http://eaglenet.xtgem.com/index"){
location.replace('http://eaglenet.xtgem.com/index?__filelist_page=<xt:random from="1" to="num" x="1"/>')};
</script>
Copy code
Lordeagle
Lordeagle Remove quotes (" ") from addition sign in the above code