* Graham This is a rather complex script that uses xtscript and filelist to create a javascript array of the search results which is then sorted and paged
it uses "post" so no querystring
There are all sorts of tricks used to output the js correctly so careless editing may break the script
The actual file lists are not in the xtscript so should not get timeouts
The search query must be 2 or more chars and is filtered against malicious input
This version is set up to search 4 folders
still subject to change
SUGGESTIONS WELCOME
demo http://ggnnww.yn.lt/filelist_folder/newsearch
<!--parser:xtscript-->
var $per_page=5
get search
# Search string health check
var $star= call strpos $haystack=#$search;$needle=*
var $query= call strpos $haystack=#$search;$needle=?
var $dquot= call strpos $haystack=#$search;$needle="
var $squot= call strpos $haystack=#$search;$needle='
if not $search or $star or $query or $dquot or $squot
del $search
var $disable_js=//
goto @end1
endif
# Search string length check
var $len=call strlen $val=$search
if $len < 2
del $search
print search string too short min 2 chars<br />
goto @end1
endif
# Do the search
get anywhere
if $anywhere
var $checked=checked="checked"
var $any=*
endif
var $dummy=['dummy']
# Filelist template that creates javascript array 
var $template=['.file_name_parsed.','.file_url.','.file_size.','.file_datetime.','.file_mime.'],
# Filelist templates
var $list1= xt:filelist folder="/FOLDER1" template="$template"  filter="$any$search*.*" per_page="0"
var $list2= xt:filelist folder="/FOLDER2" template="$template"  filter="$any$search*.*" per_page="0"
var $list3= xt:filelist folder="/FOLDER3" template="$template"  filter="$any$search*.*" per_page="0"
var $list4= xt:filelist folder="/FOLDER4" template="$template"  filter="$any$search*.*" per_page="0"
@end1
# The search form
print {{<div style="border:1px solid;padding:2px;margin:2px;display:inline-block">
<form action="<xt:url/>" method="post">
<input type="search" name="search" value="$search" />
<input type="submit" value="go" /><br />
Anywhere in filename <input type="checkbox"  name="anywhere" value="1" $checked />
</form>
</div><br />}}
# The actual filelist functions are created below 
<!--/parser:xtscript-->
<script type="text/javascript">
{_$$disable_js|}var list=[<{_$$list1|} ><{_$$list2|} ><{_$$list3|} ><{_$$list4|} >{_$$dummy|}];
<!--parser:xtscript-->
# The output script
get_or_default results_page;0
if $search
print {{list.length=list.length-1; 
var length=list.length;
if (length){
var total_pages=Math.floor(}}
print {{list.length/$per_page);
var results_page=$results_page;
var search='$search';
var per_page=$per_page}}
print_raw {{;
var offset=(results_page*per_page);
var page_end=(offset + per_page);
if (page_end > length)page_end=length;
list.sort();
document.write('<div style="border:1px solid;padding:2px;margin:2px;text-align:left">');
if (length > 1)document.write((offset+1)+' to '+page_end+' of ');
document.write( length+' Result');
if (length > 1) document.write('s');
document.write(' For &quot;<b>'+search+'</b>&quot;<br />');
for(i=offset;i < page_end;i++){
document.write('<div style="border:1px solid;padding:2px;margin:2px;text-align:left;">');
document.write('<a href="'+list[i][1]+'?__xt_download=1">'+list[i][0]+'</a><br />');
document.write('Url <input  value="'+list[i][1]+'" /><br />');
document.write('<small> Size <span>'+list[i][2]+'</span>');
document.write(' Date <span>'+list[i][3]+'</span>');
document.write(' Type <span>'+list[i][4]+'</span></small></div>');}
}}
# Pagination
print_raw {{
if (length > per_page){
document.write('<div>');
if (offset){
document.write('<form style="display:inline" action="<xt:url />" method="post"><input type="hidden" name="results_page" value="'+(results_page-1)+'" />}}
print <input type="hidden" name="search" value="$search" /><input type="hidden" name="anywhere" value="$anywhere" />
print_raw {{<input type="submit" value="&larr;" /></form>');} else {document.write('<input type="button" value="&bull;"  />');}
if (page_end < length){
document.write('<form style="display:inline" action="<xt:url />" method="post"><input type="hidden" name="results_page" value="'+(results_page+1)+'" />}}
print <input type="hidden" name="search" value="$search" /><input type="hidden" name="anywhere" value="$anywhere" />
print_raw {{<input type="submit" value="&rarr;" /></form>');} else {document.write('<input type="button" value="&bull;"  />');}
document.write('</div>');} 
document.write('</div>'); ;}}
endif
if $search
print } else {document.write('<div style="border:1px solid;padding:2px;margin:2px;display:inline-block;text-align:left;">
print No results for $search</div>');}
endif
<!--/parser:xtscript-->
</script>

Copy code
2015-03-12 13:37 (edited 2015-03-12 14:32 by Graham ) · (2)
* kapilover08 * Graham I'm creating a form in table section and now, where can I put that code in this section?

<table width="100%" cellspacing="0" cellpadding="0"><tbody><tr><td>
<form name="search" id="search" action="" method="get">
<table width="100%" cellspacing="0" cellpadding="0"><tbody><tr>
<td><div id="searchArea"><div class="icon iconCancel" id="searchCancel"></div><input name="search" class="text" id="searchText" type="text" placeholder="Search" value="" autocomplete="off"></div></td>
<td width="10"><button class="submit" id="searchBtn" type="submit"><div class="icon iconSearch"></div></button></td>
</tr></tbody></table>
<input name="sh" type="hidden" value="">
</form>
</td><td width="10">
<a class="inp" id="catSel" href="/category" target="_blank">Categories</a>

</td></tr></tbody></table>
2015-03-13 07:09 · (0)
* Graham * kapilover08 Your whole code would go where I have the simple search form in my code
2015-03-13 22:28 · (0)
* Graham further test version this one with thumbnails html5 audio/video and flash objects
http://ggnnww.yn.lt/filelist_folder/newsearch_2
2015-03-13 22:30 · (0)
* kapilover08 * Graham Nice one moder. But it is possible to resize the audio/video player using CSS? I already saw your sample but the a/v player is not fit in your site.
2015-03-13 22:37 · (0)
* Graham * kapilover08 This is just a test and I have not included any css for the audio/video yet it is using standard html5 audio/video tags so yes it is resizeable all the normal width/height and some others should work
I just set style="max-width:160px" is that working on your browser ?
2015-03-13 23:39 (edited 2015-03-13 23:49 by Graham ) · (0)
* kapilover08 * Graham I fixed it now moder about the width/height. But I have an another question related in html5 video. It is working if I use it to filelist with landing page? What I mean is, I want to use the html5 video after filelist. In short is the interstitial page.
2015-03-14 01:30 · (0)
* Graham * kapilover08 as long as you pass the mime type to your landing page or detect it on the landing page so that you know which tag to use <audio> and <video> are just html tags
the best way is to use another filelist function on the landing page with the files name as the filter then you only have to pass 1 variable (the files unique name) to the landing page everything else can be got from the filelist function
2015-03-14 11:44 (edited 2015-03-14 11:51 by Graham ) · (0)
* kapilover08 * Graham Moder I think it is doesn't play the html5 video in landing page if the site is enable the 5mb file size limit option. I try to create it but it's not working. html5 video attempt me INVALID SOURCE.
2015-03-15 13:27 · (0)
* kapilover08 * Graham My other site without additional features 5mb file size is still working on the html5 video in landing page.
2015-03-15 13:30 · (0)

Online: Guests: 1