# HG changeset patch # User Matti Hamalainen # Date 1442224196 -10800 # Node ID 59075f5e7a62cfe4b1ff31a70eb9d6f6dc98adf1 # Parent 8c1599a30120479340abcd61ff11aac6ee312222 Add configuration setting to enable and disable use of HTML table elements. diff -r 8c1599a30120 -r 59075f5e7a62 example.cfg --- a/example.cfg Mon Sep 14 12:49:29 2015 +0300 +++ b/example.cfg Mon Sep 14 12:49:56 2015 +0300 @@ -22,6 +22,8 @@ ; Use image from sub-album as album cover image cover_images = yes +; Use table elements? If disabled, CSS is responsible for formatting +use_tables = yes ;;; ;;; Important paths and urls diff -r 8c1599a30120 -r 59075f5e7a62 mgallery.inc.php --- a/mgallery.inc.php Mon Sep 14 12:49:29 2015 +0300 +++ b/mgallery.inc.php Mon Sep 14 12:49:56 2015 +0300 @@ -59,6 +59,7 @@ "cache_file" => array(MG_STR, ".mgallery.cache"), "cover_images" => array(MG_BOOL, TRUE), + "use_tables" => array(MG_BOOL, TRUE), "clean_urls" => array(MG_BOOL, FALSE), "title_prefix" => array(MG_STR, ""), diff -r 8c1599a30120 -r 59075f5e7a62 mgallery.php --- a/mgallery.php Mon Sep 14 12:49:29 2015 +0300 +++ b/mgallery.php Mon Sep 14 12:49:56 2015 +0300 @@ -125,7 +125,7 @@ function mgPrintTable($class, &$galEntries, &$galIndex, $start, $limit) { - global $galAlbumIcon, $galPath, $galTNPath, $galImageURL, $galUseCoverImages; + global $galAlbumIcon, $galPath, $galTNPath, $galImageURL, $galUseCoverImages, $galUseTables; $galCount = count($galIndex); if ($start >= $galCount) @@ -137,16 +137,20 @@ $rowLimit = mgGetSetting("album_row_limit"); $n = 0; - echo "\n"; + if ($galUseTables) + echo "
\n"; + for ($index = $start; $index < $end; $index++) { $filename = &$galIndex[$index]; $data = &$galEntries[$filename]; - if ($n == 0) echo " \n"; + if ($galUseTables && $n == 0) echo " \n"; - echo - " \n"; - - if (++$n >= $rowLimit) + if ($galUseTables) { - echo " \n"; - $n = 0; + echo " \n"; + if (++$n >= $rowLimit) + { + echo " \n"; + $n = 0; + } } + else + echo " \n"; } - if ($n > 0) + + if ($galUseTables) { - while ($n++ < $rowLimit) - echo " \n"; - echo " \n"; + if ($n > 0) + { + while ($n++ < $rowLimit) + echo " \n"; + echo " \n"; + } + echo "
\n"; + if ($galUseTables) + echo " \n"; + else + echo "
\n"; if ($data["type"] == 0) { @@ -181,22 +185,29 @@ "
".chentities($data["caption"])."
\n"; } - echo - "
\n"; } - echo "\n"; return $index; } @@ -251,6 +262,7 @@ $galImageURL = mgGetSetting("image_url", mgGetSetting("base_url")); $galUseCoverImages = mgGetSetting("cover_images"); +$galUseTables = mgGetSetting("use_tables"); $galAlbumIcon = mgGetSetting("album_icon"); $galCleanURLS = mgGetSetting("clean_urls");