I think this does what you want. It works in Evo. A mysterious, base_url is inserted at the beginning of each href. The url prefix is not in the database, as far as I can tell. It’s inserted dynamically when the TV is rendered. I have no idea why. The url prefix is malformed in Revo, so I can’t get it to work there.
Create a TV called DirList.
Turn the delimiter output off.
Use no output widget (leave it blank).
In the TV’s Input Option Values field, put this:
@EVAL return($modx->runSnippet('GetDir'));
Display the TV with this tag:
[*DirList*]
Create a GetDir snippet with this code:
<?php
$dir = 'c:/xampp/htdocs/modx097/assets/';
$url_base = 'assets/';
$output = '';
$first = true;
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && (!is_dir($dir . $file)) ) {
if (!$first) {
$output .= '||';
};
$output .= $file. '==' . '<li><a href="' . $url_base . $file . '">' . $file . '</a></li>';
if ($first == true) $first = false;
}
}
closedir($handle);
return $output;
}
?>
Set $dir and $url_base appropriately.
BTW -- If you change the snippet, you have to reload the page containing the TV, edit the TV, and save the page before you’ll see the change.
I spent most of the day trying to get it to work in Revo before trying it in Evo (sigh).