From 2577828e1586e12a0285822fe5908fa509dafb14 Mon Sep 17 00:00:00 2001 From: filesite Date: Thu, 3 Nov 2022 19:38:59 +0800 Subject: [PATCH] improve image show --- themes/googleimage/views/layout/main.php | 2 +- themes/googleimage/views/site/index.php | 33 +++++++++++++++++++++--- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/themes/googleimage/views/layout/main.php b/themes/googleimage/views/layout/main.php index 1fffa5b..3702b2e 100644 --- a/themes/googleimage/views/layout/main.php +++ b/themes/googleimage/views/layout/main.php @@ -25,7 +25,7 @@ require_once __DIR__ . '/../../../../plugins/Html.php';
diff --git a/themes/googleimage/views/site/index.php b/themes/googleimage/views/site/index.php index e3fb748..efaece0 100644 --- a/themes/googleimage/views/site/index.php +++ b/themes/googleimage/views/site/index.php @@ -60,15 +60,22 @@ eof; } if (!empty($category['directories'])) { //两级目录支持 + $index = 0; foreach($category['directories'] as $dir) { echo << eof; if (!empty($dir['snapshot'])) { - echo << 0) { + echo << eof; + }else { + echo << +eof; + } }else if (!empty($dir['files'])) { $first_img = array_shift($dir['files']); if (!in_array($first_img['extension'], $imgExts)) { @@ -81,9 +88,15 @@ eof; } if (in_array($first_img['extension'], $imgExts)) { - echo << 0) { + echo << eof; + }else { + echo << +eof; + } }else { echo << @@ -96,20 +109,34 @@ eof; {$title} eof; + $index ++; } } if (!empty($category['files'])) { //一级目录支持 + $index = 0; foreach($category['files'] as $file) { if (!in_array($file['extension'], $imgExts)) {continue;} $title = !empty($file['title']) ? $file['title'] : $file['filename']; - echo << 0) { + echo << {$file['filename']} {$title} eof; + }else { + echo << + {$file['filename']} + {$title} + +eof; + } + + $index ++; } } ?>