-

- - - -




*Post reply · Invite friends · From end
* GistBirD Request for any xtgem filelist script, template, or function here.
2014-10-22 21:40 · Reply · (0)
* GistBirD XT FILELIST WITH FILE NUMBER.


This xt filelist function numbers all files a folder.

Step 1: Create a folder named upload.

Step 2: Upload your files in the folder [upload]

Step 3: Copy and paste below script in the page where you want the files to be displayed.


Script

<!--parser:xtscript-->
# Filelist Template
var $folder=uploads
var $per_page=5
get_or_default __filelist_page;1
var $list_page=($__filelist_page-1)
var $page=($list_page*$per_page)
var $template= <li><img src="http://xtgem.com/images/icons/mimes/.file_type..png" alt="*" />&nbsp;<a href=".file_url."><span>.file_name_base_parsed.</span></a> .file_mime. (.file_size.)</li>
var $template=call htmlspecialchars $val=$template
# Filelist
print <ol start="($page+1)"><xt:filelist sort_type="name" sort_dir="asc" folder="$folder" template="$template" per_page="$per_page"  filter="*.*"/></ol>
<!--/parser:xtscript-->

Copy code
2014-10-22 21:43 (edited 2014-10-22 21:46 by GistBirD ) · Reply · (0)
* GistBirD FILELIST WITH HITS COUNTER AND FILE RATING.

This requires a registration at the XtCat site
And xtcat widgets to be installed from the market page.


You cannot add xt:widgets directly in a xt:filelist template (wrong parsing
order)
But due to a quirk of xtscript you can add them if the xt:filelist is in a
xtscript variable
which is then printed by the xtscript.
The xtcat counter and ratings widgets use the file_name variable as their
call value
xtcat's counter widget has a display only mode (type="display1") this
mode is used in the xt:filelist template
The counter is incremented on the landing page by a normal xtcat counter
which you could hide by giving it a type="none"
The rating widget for each file is on the landing page
This demo includes the landing page into the same page and xtscript as the
xt:filelist


Copy Script.
<!--parser:xtscript-->
var $path=/PATH/TO/FILES
var $xtuser=YOUR XTCAT USERNAME
var $key=YOUR XTCAT KEY
get file_name
var $template=<a href="? file_name=.file_name.&amp;__filelist_page=$__filelist_page" />.file_name_base_parsed. </a><br />Type .file_mime.<br />Size .file_size.<br />Date .file_datetime.<br />Hits <xt:widget id="xt.c.a.t." tool="Counter" type="display1" key="$key" xtuser= "$xtuser" call=".file_name."/><hr />
 var $template=call htmlspecialchars $val=$template
 var $list =<xt:filelist sort_type="name" sort_dir="desc" folder="$path" template="$template" per_page="3" filter="*.*"/>
 print $list
 else
 # landing page
 # Template must be all on one line
 var $template=Download <a href=".file_url."> .file_name_parsed.</a><br />.file_size.<br />.file_datetime.<br />Hits <xt:widget id="xt.c.a.t." tool="Counter"  key="$key" xtuser= "$xtuser" call="$file_name"/><br/><xt:widget id="xt.c.a.t." tool="Ratings" text1="Rate $file_name" text2="Not Yet Rated. Be The First." text3="Your Rating" text4="Out Of" text5="Total Votes" button1="Rate It!"  key="$key" xtuser= "$xtuser" call="$file_name" /><hr />
 var $template=call htmlspecialchars $val=$template
 var $list=<xt:filelist folder="$path" template="$template"  filter="$file_name"/>
 print $list
 print <a href="?__filelist_page=$__filelist_page"/>Back</a>
 endif
<!--/parser:xtscript-->

Copy code
2014-10-22 22:03 · Reply · (0)

Online: Guests: 1

SITE STATISTICS
Online Users 1 / 163 Today

Registered members 52 / 28 Subscribed members





pacman, rainbows, and roller s