<?php
// Shows all files in the directory,
$newline = "<br/>";
$dir = $modx->config['base_path'].'assets/yourfiles'; // set path to files
$dir_array = array(); // main array - contains all file names in directory
// open directory and parse file list
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
// iterate over file list to create full directory array
while (($filename = readdir($dh)) !== false) {
if (($filename != ".") && ($filename != "..") && ($filename != "WS_FTP.LOG")) { // skip self, parent, and ftp log
$dir_array[] = $filename; // add the filename to the array
}
}
closedir($dh); // close directory
}
natsort($dir_array); // sort in ascending order -- delete if you don't need them sorted.
// $dir_array = array_reverse($dir_array, false); // reverse array (descending) if needed.
$n = count($dir_array); // total number of files -- might want this for something
$output = "";
$output .= "<ul>"
foreach ($dir_array as $value) { // iterate through array of filenames.
$output .= '<li>'.$value.'</li>';
}
$output .='</ul>';
}
return $output;
?>if (($filename != ".") && ($filename != "..") && ($filename != "WS_FTP.LOG")) { // skip self, parent, and ftp logif (($filename != ".") && ($filename != "..") && ($filename != "WS_FTP.LOG") && (!preg_match('/^.thumb_/', $filename))) { // skip self, parent, and ftp log
<?php
/* -------------------------------------------------------------
:: Snippet: Returns Directory Contents
----------------------------------------------------------------
Short Description:
Returns Directory Contents, excludes self, parent, ftp log and thumbnail with prefix (.thumb_)
Date:
05/16/2008
----------------------------------------------------------------
:: Example Call
----------------------------------------------------------------
[!directory? &Location=`yourdirectory`!]
A call that describes the directory inside of assets/images/ that you want called in.
------------------------------------------------------------- */
// Shows all files in the directory (assumes you are in assets/images/),
$newline = '';
$dir = $modx->config['(site_url)'].'assets/images/'.$Location.'/'; // set path to files
$dir_array = array(); // main array - contains all file names in directory
// open directory and parse file list
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
// iterate over file list to create full directory array
while (($filename = readdir($dh)) !== false) {
if (($filename != ".") && ($filename != "..") && ($filename !="WS_FTP.LOG") && (!preg_match('/^.thumb_/', $filename))) { // skip self, parent, and ftp log and thumb prefix
$dir_array[] = $filename; // add the filename to the array
}
}
closedir($dh); // close directory
}
natsort($dir_array); // sort in ascending order -- delete if you don't need them sorted.
// $dir_array = array_reverse($dir_array, false); // reverse array (descending) if needed.
$n = count($dir_array); // total number of files -- might want this for something
$output = '';
$output .= '<ul id="mycarousel" class="jcarousel-skin-tango">';
foreach ($dir_array as $value) { // iterate through array of filenames.
$output .= '<li><img src="'.$dir.''.$value.'" /></li>';
}
$output .='</ul>';
}
return $output;
?>
$output .= '<li><a href="'.$dir.''.$value.'" rel="sexylightbox[group1]"> <img src=[!MiniPhoto? &file=`"'.$dir.''.$value.'"` &dir=`mini` &height=`130`!] /></li>';
I dont want to make the thumbs manually!.. thx
$output .= '<li><a href="'.$dir.''.$value.'" rel="sexylightbox[group1]"> <img src="[[MiniPhoto? &file=`'.$dir.''.$value.'` &dir=`mini` &height=`130`]]" /></li>';