* rkumar29 <!--parser:xtscript-->
# SETTINGS

#____________________________#

# Xtcat details for counters

# Set to 1 to enable counters
var $use_xtcat_counters=0
# Counters will not function without valid xtcat details
var $xtuser=XTCAT USERNAME
var $key=XTCAT KEY

# Filelist page settings
var $path=/filelist_folder/files
var $sort_type=name
var $sort_dir=asc
var $per_page=5
var $preview_img_height=16px
# Set to 0 for no short description in filelist
var $description_in_list=1
# Set to 0 to skip pagination conversion or if custom paging in use
var $convert_to_blog_paging=1

# Landing page settings
var $description_path=/filelist_folder/descriptions
# set label text to enable options
var $link_label=Download
var $view_link_label=Open
var $type_label=Type
var $size_label=Size
var $size_type=file_size
var $counter_label=Hits
var $date_label=Date
var $date_type=file_datetime
# Set to 0 to disable social buttons
var $hupso_social_buttons=1

# Search form settings
# set to 0 to disable search
var $show_search=1
var $search_title=Search files
var $search_box_width=10em
var $search_button_text=Search
var $no_results=No Results For

# Back button
var $back_button_text=Back to list

#_____________________________#

# SCRIPT

# Outer container
print <div class="xt_container xt_blog_parent">

# Get any search pattern entered
get search

# Show list or goto landing page
get_or_default __filelist_page;1
get __file_name
if $__file_name
goto @landing_page
endif

# FILELIST PAGE

# Template for filelist
var $template= <a style="display:inline;" class="xt_blog_title_link" href="?__file_name=.file_name.&amp;amp;__filelist_page=$__filelist_page
if $search
var $template= $template&amp;amp;search=$search
endif
var $template= $template"><span class="xt_heading" style="display:inline;">.file_name.</span>
if $use_xtcat_counters
var $template= $template<span class="xt_blog_comments_number" style="display:inline;"> $counter_label <xt:widget id="xt.c.a.t." tool="Counter" type="display1" key="$key" xtuser= "$xtuser" call=".file_name." label_0="test"/></span>
endif
var $template= $template</a>
var $template=call htmlspecialchars $val=$template

# Main filelist function
var $list =<xt:filelist sort_type="$sort_type" sort_dir="asc" folder="$path" template="$template||" per_page="$per_page" filter="$search*.*"/>

# Find end of filelist entries and start of pagination
var $list_end=call strrpos $haystack=$list;$needle=||

# Create list containers
print <div class="xt_list"><div class="xt_blog_post_list">

# Main loop
var $offset=0
@loop

# Get the next entry
var $list_entry_end=call strpos $haystack=$list;$needle=||;$offset=$offset
var $list_entry=call substr $val=$list;$start=$offset;$length=($list_entry_end-$offset)

# Get description file name
var $desc_file_name_start=call strpos $haystack=$list_entry;$needle=name=;$offset=0
var $desc_file_name_end=call strpos $haystack=$list_entry;$needle=.;$offset=$file_name_start
var $desc_file_name=call substr $val=$list_entry;$start=($desc_file_name_start+5);$length=($desc_file_name_end-$desc_file_name_start-5)

# Get description file
var $description=call source $file=$description_path/$desc_file_name;$html_safe=0;

# No description file
if not $description
delete $img
goto @output_list_entry
endif

# Is it a full html page
var $description_content_offset=call strpos $haystack=$description;$needle=<body;

# Extract content of body tags
if $description_content_offset
var $description_content_start=call strpos $haystack=$description;$needle=>;$offset=$description_content_offset
var $description_content_end=call strpos $haystack=$description;$needle=</body;$offset=$description_content_offset
var $description=call substr $val=$description;$start=($description_content_start+1);$length=($description_content_end-$description_content_start-1)
endif

# Is there a image in the description
var $is_img=call strpos $haystack=$description;$needle=img;$offset=0
if $is_img

# Get the path to the first image
var $first_img_start=call strpos $haystack=$description;$needle=src=";$offset=$is_img
var $first_img_end=call strpos $haystack=$description;$needle=";$offset=($first_img_start+5)
var $first_img=call substr $val=$description;$start=($first_img_start+5);$length=($first_img_end-$first_img_start-5)

# Create image code for preview images in filelist
var $img=<img class="xt_img" src="$first_img" style="height:$preview_img_height;display:inline;padding:2px" alt="*"/>
endif

# Are item descriptions on
if not $description_in_list
goto @output_list_entry
endif

# Get the item description
var $first_text_start=call strpos $haystack=$description;$needle=xt:text;$offset=0
if $first_text_start
var $first_text_end=call strpos $haystack=$description;$needle=</xt:text>;$offset=($first_text_start+8)
var $first_text=call substr $val=$description;$start=($first_text_start+8);$length=($first_text_end-$first_text_start-8)
var $item_description=<div class="xt_description" style="display:block;vertical-align:middle">$first_text</div>
endif

#Output this entry or no results
@output_list_entry
if $list_entry
print <div class="xt_item"><span> $img $list_entry</span>$item_description</div>
else
print <div class="xt_item"><span>$no_results $search</span></div>
endif

# Increment offset and loop back if not at the end
delete $item_description
delete $img
var $offset=($list_entry_end+2)
if $offset < $list_end
goto @loop
endif

# Close list containers
print </div></div>

# Pagination
var $paging=call substr $val=$list;$start=($list_end+2)
if not $convert_to_blog_paging
goto @output_paging
endif

# Convert to xt:blog pagination markup
var $paging=call str_replace $subject=$paging;$search=filelist_paging;$replace=xt_pagination
var $paging=call str_replace $subject=$paging;$search=<span>;$replace=<span class="selected"><span>
var $paging=call str_replace $subject=$paging;$search=</span>;$replace=</span></span>
var $paging=call str_replace $subject=$paging;$search=<a;$replace=<span><a
var $paging=call str_replace $subject=$paging;$search=a>;$replace=a></span>
var $p_offset=0
@p_loop
var $p_start=call strpos $haystack=$paging;$needle=__filelist_page;$offset=$p_offset
if $p_start
var $p_start=call strpos $haystack=$paging;$needle=>;$offset=$p_start
var $p_end=call strpos $haystack=$paging;$needle=<;$offset=$p_start
var $page_num=call substr $val=$paging;$start=$p_start;$length=($p_end-$p_start+1)
var $paging=call str_replace $subject=$paging;$search=$page_num;$replace=><span$page_num/span><
var $p_offset=($p_end+6)
goto @p_loop
endif

# Output pagination
@output_paging
print $paging

# SEARCH FORM

# Create search container
if $show_search
print <div class="xt_container xt_blog_search" style="display:inline-block">

# The search form
get search
print <form action="?__filelist_page=$__filelist_page" method="get">
print <div class="xt_label" style="display:block"><label for="search" >$search_title</label></div>
print <span class="xt_input"><input style="max-width:$search_box_width;" id="search" required="required" name="search" value="$search" type="search"/></span>
print <span class="xt_submit"><input class="xt_button" type="submit" value="$search_button_text"/></span>
print </form>
endif

# Show back to list button
if $search
print <a class="xt_blog_back_to_posts xt_link xt_button" href="?__filelist_page=$__filelist_page">$back_button_text</a>
endif

# Close search container
if $show_search
print </div>
endif

# Finish
goto @end

# LANDING PAGE
@landing_page

# Template for landing page list entry
if $link_label
var $template=<div class="xt_label" style="display:block"><label>$link_label</label> <a href=".file_url.?__xt_download=1" download=".file_name.">.file_name.</a></div>
endif
if $view_link_label
var $template=$template<div class="xt_label" style="display:block"><label>$view_link_label</label> <a target="_blank" href=".file_url.">.file_name.</a></div>
endif
if $type_label
var $template=$template<div class="xt_label" style="display:block"><label>$type_label</label> <img src="http://xtgem.com/images/icons/mimes/.file_type..png" alt="*" style="border:none;padding:0"/> .file_mime.</div>
endif
if $size_label
var $template=$template<div class="xt_label" style="display:block"><label>$size_label</label> .$size_type.</div>
endif
if $use_xtcat_counters
var $template=$template<div class="xt_label" style="display:block"><label>$counter_label</label> <xt:widget id="xt.c.a.t." tool="Counter" key="$key" xtuser="$xtuser" call=".file_name."/></div>
endif
if $date_label
var $template=$template<div class="xt_label" style="display:block"><label>$date_label</label> .$date_type.</div>
endif

var $template=call htmlspecialchars $val=$template

# File list function filtered by the file_name to create this list entry
var $list_entry= <xt:filelist sort_type="name" sort_dir="desc" folder="$path" template="$template" per_page="0" filter="$__file_name"/>

# Get the description file
var $description_name=call strpos $haystack=$__file_name;$needle=.;
var $description_name=call substr $val=$__file_name;$start=0;$length=$description_name
var $description=call source $file=$description_path/$description_name;$html_safe=0;

# Create list entry container
print <div class="xt_blog">

# list entry title
var $space=call chr $val=32
var $item_title=call str_replace $subject=$description_name;$search=_;$replace=$space
print <h2 class="xt_blog_title">$item_title</h2>

# Create entry content container
print <div class="xt_blog_content xt_text normal">

# No description file
if not $description
goto @output_item
endif

# If the description is a html page
var $description_content_offset=call strpos $haystack=$description;$needle=<body;
if $description_content_offset

# Extract just the content of the body tags
var $description_content_start=call strpos $haystack=$description;$needle=>;$offset=$description_content_offset
var $description_content_end=call strpos $haystack=$description;$needle=</body;$offset=$description_content_offset
var $description=call substr $val=$description;$start=($description_content_start+1);$length=($description_content_end-$description_content_start-1)
endif

# Output list entry description
print $description

# Output list entry
@output_item
print $list_entry

# Output Hupso share buttons
if $hupso_social_buttons
print_raw {{<!-- Hupso Share Buttons - http://www.hupso.com/share/ --><a class="hupso_toolbar" href="http://www.hupso.com/share/"><img src="http://static.hupso.com/share/buttons/share-medium.png" style="border:0px; padding-top:5px; float:left;" alt="Share Button"/></a>
<script type="text/javascript">var hupso_services_t=new Array("Twitter","Facebook","Google Plus","Linkedin","StumbleUpon");var hupso_toolbar_size_t="medium";</script>
<script type="text/javascript" src="http://static.hupso.com/share/js/share_toolbar.js"></script>
<!-- Hupso Share Buttons -->}}
endif

# Close entry content container
print <br style="clear:both" /></div>

# Back to filelist link
print <a class="xt_blog_back_to_posts xt_link xt_button" href="?__filelist_page=$__filelist_page
if $search
print &amp;search=$search
endif
print ">$back_button_text</a>

# Close list entry container
print </div>

# End of script
@end

# Close outer container
print </div>
<!--/parser:xtscript-->

i am using this script but still unable to show preview of video files plz help graham sir..
2014-11-27 21:37 · (1)
* Graham You need to add your own still image in the description file the script does not create it for you
2014-11-27 23:42 (edited 2014-11-27 23:45 by Graham ) · (1)
* rkumar29 * Graham suppose i upload a file with name video.3gp and the image file should video.3gp.png?
2014-11-28 08:45 · (1)
* rkumar29 * rkumar29 everything is working fine else the video image preview. Otherwise it is an excellent piece of work. Thank you graham sir.
2014-11-28 08:47 · (1)
* Graham * rkumar29 it takes the image from the first image in the description it does not matter what it is called
2014-11-28 08:56 · (1)
* rkumar29 * Graham ok sir. So i need to make and folder name "descriptions" right?
2014-11-28 09:12 · (1)
* Graham * rkumar29 Yes the way the script works is the description file must be in a folder named "descriptions"
and the file has the same name as the item but without any extension (ie no .html or .txt etc )
it can be a normal xtgem html page or a plain text file
the script extracts the content of the first <xt:text>...</xt:text> pair to use as the short description in the file list and the first image to use as the thumbnail image
the full description can contain more text blocks and more images
and these are displayed on the landing page
I think spaces in the file names cause problems so avoid them
the original is here http://ggnnww.yn.lt/all_tricks_filelist
The script is a bit complex but I wanted to add nearly everything I could think of
2014-11-28 10:46 (edited 2014-11-28 11:00 by Graham ) · (0)
* admin_teGa * Graham Help me, This is what is wrong?

<script language="text/javascript">
var time=<xt id="countdown" format="seconds" from="now" to="01 jan 2016"/>;
time2=time-21600;
time3=time2%(3600*24);
time4=time3%3600;
time5=time4%60;
time6=time5 ngay=(time2-time3)/(3600*24);
gio=(time3-time4)/3600;
phut=(time4-time5)/60;
if
(ngay<=0&&gio<=0&&phut<=0&&time5<=0)
{
document.write('<font color="red" size="30">HAPPY NEW YEAR 2014</font><br><b>Chúc mọi người một năm mới an khang thịnh vượng</b>');
}
else{
document.write('<b>Còn
lại <font color="blue">'+ngay+'</font> ngày <font color="blue">'+gio+'</font> giờ <font color="blue">'+phut+'</font> phút <font color="blue">'+time5+'</font> giây nữa là tới
<font color="red">TẾT 2014</font></b>');
}
</script>
2015-01-04 19:11 · (0)
* oumarcl.xtgem.com * rkumar29 nice
2015-01-05 15:37 (edited 2015-01-05 15:42 by oumarcl.xtgem.com ) · (0)
* Graham * admin_teGa type not language
time6=time5;
ngay=(time2-time3)/(3600*24);

<script type="text/javascript">
var time=<xt id="countdown" format="seconds" from="now" to="01 jan 2016"/>;
time2=time-21600;
time3=time2%(3600*24);
time4=time3%3600;
time5=time4%60;
time6=time5; 
ngay=(time2-time3)/(3600*24);
gio=(time3-time4)/3600;
phut=(time4-time5)/60;
if
(ngay<=0&&gio<=0&&phut<=0&&time5<=0)
{
document.write('<font color="red" size="30">HAPPY NEW YEAR 2014</font><br><b>Chúc mọi người một năm mới an khang thịnh vượng</b>');
}
else{
document.write('<b>Cònlại <font color="blue">'+ngay+'</font> ngày <font color="blue">'+gio+'</font> giờ <font color="blue">'+phut+'</font> phút <font color="blue">'+time5+'</font> giây nữa là tới<font color="red">TẾT 2014</font></b>');
}
</script>

Copy code
2015-01-06 02:16 · (0)

Online: Guests: 1