Disaru
I placed three file lists in one page, one on center page and two on sidebar.
The problem is, if I click the file list in center page to next page, so now the url has parameter has "__filelist_paging=2", the file list in the sidebar also changed to page 2.
Is there anyway so that the "__filelist_paging=2" url parameter Not affect the other file list in the sidebar? Thanks
Graham
Disaru This is what I figured out
Basically The script reads the entire list into a xtscript variable and then paginates it
you should use the standard filelist for your largest folder as if the folders are over large you could get xtscript timeouts
I used a simple [prev] [next] type pagination for the scripts the pagination includes routines to include the page numbers of the other lists in the paging to preserve the page numbers of the other filelists
the examples are unstyled
You can set your own template but it must end with
<!--##--> (<!--##-->) as this is used to mark the end of each item in the list
this is the first extra list script
<!--parser:xtscript-->
var $list=<xt:filelist sort_type="name" sort_dir="asc" folder="/folder1" template="<a href=".file_url.?__xt_download=1&l=2">.file_name_base_parsed.</a><br /><!--##-->" per_page="0" />
var $per_page=5
get_or_default pgnmbr1;1
var $this_page=1
var $start=0
var $end=0
var $count=0
var $len=call strlen $val=$list
@loop
var $end=call strpos $haystack=$list; $needle=<!--##-->; $offset=($end+9) ;
if $end == ($len-9)
goto @end
endif
var $count=($count+1)
if $count == $per_page
goto @next
endif
goto @loop
@next
if $this_page < $pgnmbr1
var $start=($end+9)
var $count=0
var $this_page=($this_page+1)
goto @loop
endif
@end
var $page = call substr $val=$list; $start=$start ; $length=($end-$start)
print $page
get __filelist_page
if $__filelist_page
var $flp=&__filelist_page=$__filelist_page
endif
get pgnmbr2
if $pgnmbr2
var $pn2=&pgnmbr2=$pgnmbr2
endif
if $pgnmbr1 >1
print <a href="?pgnmbr1=($pgnmbr1-1)$pn2$flp">prev </a>
else
print prev
endif
if $end < ($len-9)
print <a href="?pgnmbr1=($pgnmbr1+1)$pn2$flp"> next</a>
else
print next
endif
<!--/parser:xtscript-->
Copy code
And this is a script set up as the second extra list
<!--parser:xtscript-->
var $list=<xt:filelist sort_type="name" sort_dir="asc" folder="/folder2" template="<a href=".file_url.?__xt_download=1&l=2">.file_name_base_parsed.</a><br /><!--##-->" per_page="0" />
var $per_page=5
get_or_default pgnmbr2;1
var $this_page=1
var $start=0
var $end=0
var $count=0
var $len=call strlen $val=$list
@loop
var $end=call strpos $haystack=$list; $needle=<!--##-->; $offset=($end+9) ;
if $end == ($len-9)
goto @end
endif
var $count=($count+1)
if $count == $per_page
goto @next
endif
goto @loop
@next
if $this_page < $pgnmbr2
var $start=($end+9)
var $count=0
var $this_page=($this_page+1)
goto @loop
endif
@end
var $page = call substr $val=$list; $start=$start ; $length=($end-$start)
print $page
get __filelist_page
if $__filelist_page
var $flp=&__filelist_page=$__filelist_page
endif
get pgnmbr1
if $pgnmbr1
var $pn1=&pgnmbr1=$pgnmbr1
endif
if $pgnmbr2 >1
print <a href="?pgnmbr2=($pgnmbr2-1)$pn1$flp"> prev </a>
else
print prev
endif
if $end < ($len-9)
print <a href="?pgnmbr2=($pgnmbr2+1)$pn1$flp"> next</a>
else
print next
endif
<!--/parser:xtscript-->
Copy code the scripts should be kept separate to prevent the @markers from clashing
demo page
http://banana.madpath.com/multilist
Disaru
Graham Yahoo! It work like a charm, Thank you very much
Can I ask one more thing ? thehe
Is there something wrong about this code:
<!--parser:xtscript-->
get __filelist_page
if $__filelist_page
print <meta name="robots" content="noindex, nofollow" />;
<!--/parser:xtscript-->
Copy code
Remeber I said before about xtscript not working only on my homepage? I think the code is the culprit, when I delete it the xtscript on homepage working again?
What I want is to print meta robots no follow, when the url has
__filelist_page= query ...
Graham
Disaru I just tried it and the reason is no endif
without it the other xtscripts on the page timed out
also you should extend the script to allow for the other filelists
<!--parser:xtscript-->
get __filelist_page
get pgnmbr1
get pgnmbr2
if $__filelist_page or $pgnmbr1 or $pgnmbr2
print <meta name="robots" content="noindex, nofollow" />;
endif
<!--/parser:xtscript-->
Copy code