From fda57f3b7c52ea9747e8c132c4571772ab913752 Mon Sep 17 00:00:00 2001 From: Romain d'Alverny Date: Sat, 15 Jan 2022 16:41:25 +0100 Subject: Refactor main controller and templates Templates for the public part: - archive/default views are merged into a single set - becomes HTML5 Controller code is reorganized for clarity. Compiled template caching is also fixed and activated when config cache value is > 0. Caching is also given new default larger values. --- custom/views/archive/footer.tpl.php | 3 - custom/views/archive/head.tpl.php | 6 -- custom/views/archive/index.tpl.php | 114 ----------------------------------- custom/views/archive/sidebar.tpl.php | 34 ----------- custom/views/archive/top.tpl.php | 4 -- custom/views/default/archive.tpl.php | 105 ++++++++++++++++++++++++++++++++ custom/views/default/footer.tpl.php | 8 +-- custom/views/default/head.tpl.php | 9 ++- custom/views/default/index.tpl.php | 19 +----- custom/views/default/top.tpl.php | 11 +++- 10 files changed, 128 insertions(+), 185 deletions(-) delete mode 100755 custom/views/archive/footer.tpl.php delete mode 100644 custom/views/archive/head.tpl.php delete mode 100755 custom/views/archive/index.tpl.php delete mode 100755 custom/views/archive/sidebar.tpl.php delete mode 100644 custom/views/archive/top.tpl.php create mode 100644 custom/views/default/archive.tpl.php (limited to 'custom') diff --git a/custom/views/archive/footer.tpl.php b/custom/views/archive/footer.tpl.php deleted file mode 100755 index c9c84b1..0000000 --- a/custom/views/archive/footer.tpl.php +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/custom/views/archive/head.tpl.php b/custom/views/archive/head.tpl.php deleted file mode 100644 index 005a75d..0000000 --- a/custom/views/archive/head.tpl.php +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/custom/views/archive/index.tpl.php b/custom/views/archive/index.tpl.php deleted file mode 100755 index 679ef71..0000000 --- a/custom/views/archive/index.tpl.php +++ /dev/null @@ -1,114 +0,0 @@ -get_date('U')) / (60*60*24); - if ($age < 1) { - $today[] = $item; - } elseif ($age < 7) { - $week[] = $item; - } elseif ($age < 30) { - $month[] = $item; - } else { - $older[] = $item; - } -} - -header('Content-type: text/html; charset=UTF-8'); -?> - - - - - - - <?php echo $PlanetConfig->getName(); ?> - - - - -
- - -
- -
-

- -

-

-
- - -
-

- -
- - - -
-

- -
- - - -
-

- -
- - - -
-

- -
- -
- - - - -
- - diff --git a/custom/views/archive/sidebar.tpl.php b/custom/views/archive/sidebar.tpl.php deleted file mode 100755 index 7a5d080..0000000 --- a/custom/views/archive/sidebar.tpl.php +++ /dev/null @@ -1,34 +0,0 @@ -getPeople(); -usort($all_people, array('PlanetFeed', 'compare')); -?> - diff --git a/custom/views/archive/top.tpl.php b/custom/views/archive/top.tpl.php deleted file mode 100644 index 7a818e1..0000000 --- a/custom/views/archive/top.tpl.php +++ /dev/null @@ -1,4 +0,0 @@ -
-

getName(); ?>

-
- \ No newline at end of file diff --git a/custom/views/default/archive.tpl.php b/custom/views/default/archive.tpl.php new file mode 100644 index 0000000..f775971 --- /dev/null +++ b/custom/views/default/archive.tpl.php @@ -0,0 +1,105 @@ +getName() . ' · ' . _g('All Headlines'); +$count = 0; +$today = array(); +$week = array(); +$month = array(); +$older = array(); +$now = time(); + +foreach ($items as $item) { + $age = ($now - $item->get_date('U')) / (60*60*24); + if ($age < 1) { + $today[] = $item; + } elseif ($age < 7) { + $week[] = $item; + } elseif ($age < 30) { + $month[] = $item; + } else { + $older[] = $item; + } +} + +header('Content-type: text/html; charset=UTF-8'); +?> + + + + + +
+ +
+ +
+

+ +

+

+
+ + + + + + +
+

+ +
+ + + +
+

+ +
+ + + +
+

+ +
+ +
+ + +
+ + diff --git a/custom/views/default/footer.tpl.php b/custom/views/default/footer.tpl.php index d7d6c1a..eeff62b 100755 --- a/custom/views/default/footer.tpl.php +++ b/custom/views/default/footer.tpl.php @@ -1,4 +1,4 @@ - + diff --git a/custom/views/default/head.tpl.php b/custom/views/default/head.tpl.php index 5773aa6..dbaf65c 100644 --- a/custom/views/default/head.tpl.php +++ b/custom/views/default/head.tpl.php @@ -1,3 +1,10 @@ + + + <?php echo $pageTitle; ?> - + + \ No newline at end of file diff --git a/custom/views/default/index.tpl.php b/custom/views/default/index.tpl.php index 5e68161..cad2a6f 100644 --- a/custom/views/default/index.tpl.php +++ b/custom/views/default/index.tpl.php @@ -1,26 +1,15 @@ getName(); $limit = $PlanetConfig->getMaxDisplay(); $count = 0; header('Content-type: text/html; charset=UTF-8'); -?> - +?> + - - - - - - - <?php echo $PlanetConfig->getName(); ?> - -
@@ -67,9 +56,7 @@ header('Content-type: text/html; charset=UTF-8');
- - diff --git a/custom/views/default/top.tpl.php b/custom/views/default/top.tpl.php index 6db425c..ed6e19c 100644 --- a/custom/views/default/top.tpl.php +++ b/custom/views/default/top.tpl.php @@ -1,3 +1,8 @@ - \ No newline at end of file + \ No newline at end of file -- cgit v1.2.1