Lordeagle
Graham Alrite thanks for the info.
Aash
I think doing these things with JavaScript is not a smart choice for me... I would prefer if there's any server-side scripting..
Graham
Lordeagle That will probably not work xt:random is a server side function that is parsed before the page is even sent to the browser where javascript is run
you would need to use a javascript random function not xt:random
Lordeagle
Lordeagle Remove quotes (" ") from addition sign in the above code
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
Graham Alright thanks for the new code i really appreciate it.
Aash
Graham Oh, that's a good one, Thanks!
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
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.
Aash
Lordeagle Its a nice script though! :thumbs: