* Graham * Waplocus You already have code that does this you just need to adapt it IE in http://forum.xtgem.com/index/__xt/post-opo9xh5lj3drsu0f220e0ects9bl5pn3hvwy0j2.html
2017-11-17 01:45 · (0)
* Waplocus * Waplocus How sir?...
2017-11-17 02:33 · (0)
* Waplocus * Waplocus Not that sir.. i mean the 1 to print only the first path name example
in /a/b/c/d.... i want to print only a... Thanks
2017-11-17 03:56 · (0)
* Graham * Waplocus
var $x=1
var $offset=0
var $count=0
var $path= <xt:url type="path" />/
@loop
var $start = call strpos $haystack=$path;$needle=/;$offset=$offset
var $end= call strpos $haystack=$path;$needle=/;$offset=($start+1)
var $name=call substr $val=$path;$start=($start+1);$length=($end-$start-1)
var $offset=($start+1)
var $count=($count+1)
if $count < $x 
goto @loop
endif
print $name

Copy code
Increase the value of x for other parts of the path
2017-11-18 01:56 · (0)
* Waplocus * Graham Please graham the variable is gotten from a url.... e.g http://site.com/apps/individualdownloadpage?Name=Java_uc_min.jar....
in the individualdownloadpage i want to filter the file using the variable value in the url
<!--parser:xtscript-->
get_or_default Name;
var $list= <xt:filelist sort_type="name" sort_dir="" folder="/Images/Backgrounds/Navigations/NS_F" template=".file_name_parsed." per_page="1" filter="$Name"/>
print $list
<!--/parser:xtscript-->

Copy code
....
when there is no value in the "Name" variable in the url How can i print "No file name was found" in xtscript above... thanks.
2017-11-25 00:13 · (0)
* Waplocus * Waplocus And also to exclude the pagination?.
2017-11-25 02:33 · (0)
* Graham * Waplocus will look shortly just got to go out for a while
2017-11-25 02:38 · (0)
* Waplocus * Graham Ok.
2017-11-25 03:49 · (0)
* Graham * Waplocus
<!--parser:xtscript-->
get Name

# If no name is set then show error and exit
if not $Name
print No file name set
goto @end
endif

var $list= <xt:filelist sort_type="name" sort_dir="" folder="/Images/Backgrounds/Navigations/NS_F" template=".file_name_parsed. " per_page="1" filter="$Name"/>

# If no file was found then show error else show the name
if not $list  
print No file found
else
print $list
endif

@end
<!--/parser:xtscript-->

Copy code
.
2017-11-25 04:28 · (0)
* Waplocus * Graham Thanks sir... but it slows down page load.
2017-11-25 06:45 · (0)

Online: Guests: 1