わかりましたので、写真でいっぱいのディレクトリがあります。
そのディレクトリ内に、次のスクリプトがあります。
<?php
// These files will be ignored
$excludedFiles = array (
''
);
// These file extensions will be ignored
$excludedExtensions = array (
'html',
'htm',
'php',
'css'
);
// Make sure we ignore . and ..
$excludedFiles = array_merge($excludedFiles,array('.','..'));
// Convert to lower case so we are not case-sensitive
for ($i = 0; isset($excludedFiles[$i]); $i++) $excludedFiles[$i] = strtolower(ltrim($excludedFiles[$i]));
for ($i = 0; isset($excludedExtensions[$i]); $i++) $excludedExtensions[$i] = strtolower($excludedExtensions[$i]);
// Loop through directory
$count = 0;
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
$extn = explode('.',$file);
$extn = array_pop($extn);
// Only echo links for files that don't match our rules
if (!in_array(strtolower($file),$excludedFiles) && !in_array(strtolower($extn),$excludedExtensions)) {
$count++;
print("<a href='#' rel='" . $file . "' class='image'><img src='" . $file . "' class='thumb' border='0'/></a>");
}
}
;
closedir($handle);
}
?>
ギャラリー スクリプトのアンカーのリストを作成するので、画像を 1 つずつ追加する必要はありません。このファイルと写真の親ディレクトリにあるスクリプトから呼び出されるため、ファイルの配列を作成する代わりに/gallery フォルダーには、ファビコン (サイト ルートにある唯一の画像) が一覧表示されます。
呼び出されているドキュメントが配置されているサイトルートではなく、ギャラリーディレクトリ内にリストを作成するようにこれに指示する方法はありますか?