kapilover08
It is possible to searching a file in multiple file folders? Share guys . Thanks.
Graham
kapilover08 filelist can only list 1 folder at a time so using the filelist filter you would just have to run the same search for each folder and then just output the results in one block but the paging (if any) would be messed up and the order may be jumpy if there are multiple returns.
In theory you could use the filelist template to populate a javascript array from the results of the filtered filelists then sort the array and add pagination with javascript
kapilover08
Graham If the file list search can only search in 1 folder at a time, can you share the code like in my attachment below? Pls!!!!
Graham
kapilover08 I am working on a script using the second option (javascript array created by xtscript and xt:filelist)
The filelists are not in the xtscript so no timeouts for big folders
but you have to be careful as js uses device memory
No pagination yet or other fancy bits and this is just a first demo of the principle NOT a usable script
http://ggnnww.yn.lt/filelist_folder/newsearch
<!--parser:xtscript-->
# Search form
get search
print {{<div>
<form action="<xt:url>" >
<input type="search" name="search" value="$search" />
<input type="hidden" name="s" value="1" />
<input type="submit" value="go" />
</form>
</div>}}
# Array template
var $template=template="['.file_name_parsed.','.file_url.','.file_size.','.file_datetime.','.file_mime.']," filter="$search*" per_page="0"
<!--/parser:xtscript-->
<script type="text/javascript">
if ({_$s|}==1 ){
var list=[<xt:filelist folder="/YOUR_FOLDER" {_$$template|}/><xt:filelist folder="/YOUR_OTHER_FOLDER" {_$$template|}/>['dummy']];
list.length=list.length-1
list.sort();
document.write('<div>');
for(i=0;i < list.length;i++){
document.write('<div>');
document.write('<a href="'+list[i][1]+'?__xt_download=1">'+list[i][0]+'</a><br />');
document.write('Size <span>'+list[i][2]+'</span><br />');
document.write('Date <span>'+list[i][3]+'</span><br />');
document.write('Type <span>'+list[i][4]+'</span>');
document.write('</div>');
}
document.write('</div>');}
</script>
Copy code