diff --git a/system/admin/views/layout.html.php b/system/admin/views/layout.html.php index f467c5a..4a92e17 100644 --- a/system/admin/views/layout.html.php +++ b/system/admin/views/layout.html.php @@ -4,9 +4,7 @@ <?php echo $title;?> - - - + diff --git a/system/htmly.php b/system/htmly.php index 30e52e2..73e4cbb 100644 --- a/system/htmly.php +++ b/system/htmly.php @@ -1301,20 +1301,14 @@ get('/search/:keyword', function ($keyword) { $posts = get_keyword($keyword, $page, $perpage); - if (!$posts || $page < 1) { - // a non-existing page or no search result - render('404-search', array( - 'title' => 'Search results not found! - ' . blog_title(), - 'description' => '', - 'breadcrumb' => '' . config('breadcrumb.home') . ' » No search results', - 'canonical' => site_url() . 'search/' . strtolower($keyword), - 'bodyclass' => 'error-404-search', - )); + $total = keyword_count($keyword); + + if (empty($posts) || $page < 1) { + // a non-existing page + render('404-search', null, false); die; } - $total = keyword_count($keyword); - render('main', array( 'title' => 'Search results for: ' . tag_i18n($keyword) . ' - ' . blog_title(), 'description' => 'Search results for: ' . tag_i18n($keyword) . ' on ' . blog_title() . '.', diff --git a/system/includes/functions.php b/system/includes/functions.php index 928f4d4..c20a0c3 100644 --- a/system/includes/functions.php +++ b/system/includes/functions.php @@ -654,7 +654,13 @@ function get_keyword($keyword, $page, $perpage) } } - return ($tmp) ? get_posts($tmp, $page, $perpage) : []; + if (empty($tmp)) { + // a non-existing page + render('404-search', null, false); + die; + } + + return $tmp = get_posts($tmp, $page, $perpage); } // Get related posts base on post tag. @@ -1537,13 +1543,7 @@ EOF; function not_found() { header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found"); - render('404', array( - 'title' => 'This page doesn\'t exist! - ' . blog_title(), - 'description' => '', - 'canonical' => false, - 'breadcrumb' => '' . config('breadcrumb.home') . ' » 404 Not Found', - 'bodyclass' => 'error-404', - )); + render('404', null, false); die(); } diff --git a/themes/blog/404-search.html.php b/themes/blog/404-search.html.php index c7b1972..041f867 100644 --- a/themes/blog/404-search.html.php +++ b/themes/blog/404-search.html.php @@ -1,16 +1,21 @@ - - - -
-
-
-
-

Search results not found!

-

Please search again, or would you like to try our homepage instead?

-
- -
-
-
+ + + + + + + + Search results not found! - <?php echo blog_title() ?> + + + + +
+

Search results not found!

+
+
-
+

Please search again, or would you like to try our homepage instead?

+ + + \ No newline at end of file diff --git a/themes/blog/404.html.php b/themes/blog/404.html.php index 2f495ce..cf762e1 100644 --- a/themes/blog/404.html.php +++ b/themes/blog/404.html.php @@ -1,14 +1,18 @@ - - - -
-
-
-
-

This page doesn't exist!

-

Please search to find what you're looking for or visit our homepage instead.

- -
-
-
-
\ No newline at end of file + + + + + + + + 404 Not Found - <?php echo blog_title() ?> + + + + +
+

This page doesn't exist!

+

Would you like to try our homepage instead?

+
+ + \ No newline at end of file diff --git a/themes/blog/layout.html.php b/themes/blog/layout.html.php index 4b8dd74..d2ca1b9 100644 --- a/themes/blog/layout.html.php +++ b/themes/blog/layout.html.php @@ -6,9 +6,7 @@ <?php echo $title;?> - - - + diff --git a/themes/clean/404-search.html.php b/themes/clean/404-search.html.php index ce5ebff..2c2485c 100644 --- a/themes/clean/404-search.html.php +++ b/themes/clean/404-search.html.php @@ -1,12 +1,21 @@ - - - -
-
-

Search results not found!

-

Please search again, or would you like to try our homepage instead?

-
- -
+ + + + + + + + Search results not found! - <?php echo blog_title() ?> + + + + +
+

Search results not found!

+ +

Please search again, or would you like to try our homepage instead?

+ + \ No newline at end of file diff --git a/themes/clean/404.html.php b/themes/clean/404.html.php index a924680..d0c24cd 100644 --- a/themes/clean/404.html.php +++ b/themes/clean/404.html.php @@ -1,10 +1,18 @@ - - - -
-
-

This page doesn't exist!

-

Please search to find what you're looking for or visit our homepage instead.

- -
-
\ No newline at end of file + + + + + + + + 404 Not Found - <?php echo blog_title() ?> + + + + +
+

This page doesn't exist!

+

Would you like to try our homepage instead?

+
+ + \ No newline at end of file diff --git a/themes/clean/layout.html.php b/themes/clean/layout.html.php index 5017490..38d5377 100644 --- a/themes/clean/layout.html.php +++ b/themes/clean/layout.html.php @@ -4,9 +4,7 @@ <?php echo $title;?> - - - + diff --git a/themes/default/404-search.html.php b/themes/default/404-search.html.php index ce5ebff..041f867 100644 --- a/themes/default/404-search.html.php +++ b/themes/default/404-search.html.php @@ -1,12 +1,21 @@ - - - -
-
-

Search results not found!

-

Please search again, or would you like to try our homepage instead?

-
- -
+ + + + + + + + Search results not found! - <?php echo blog_title() ?> + + + + +
+

Search results not found!

+
+
+

Please search again, or would you like to try our homepage instead?

+ + \ No newline at end of file diff --git a/themes/default/404.html.php b/themes/default/404.html.php index a924680..cf762e1 100644 --- a/themes/default/404.html.php +++ b/themes/default/404.html.php @@ -1,10 +1,18 @@ - - - -
-
-

This page doesn't exist!

-

Please search to find what you're looking for or visit our homepage instead.

- -
-
\ No newline at end of file + + + + + + + + 404 Not Found - <?php echo blog_title() ?> + + + + +
+

This page doesn't exist!

+

Would you like to try our homepage instead?

+
+ + \ No newline at end of file diff --git a/themes/default/css/style.css b/themes/default/css/style.css index f02a676..a554e0c 100644 --- a/themes/default/css/style.css +++ b/themes/default/css/style.css @@ -414,11 +414,6 @@ table.post-list td a { float: right; } -.error-404 .post #search-form, -.error-404-search .post #search-form { - float: none; -} - .search-input { margin: 0; padding: 4px 15px; @@ -524,7 +519,7 @@ h1.title-post a:hover, h2.title-index a:hover { padding-top: 0; } -.infront .first, .inpost .post, .intag .first, .inarchive .first, .insearch .first, .error-404 .post, .error-404-search .post { +.infront .first, .inpost .post, .intag .first, .inarchive .first, .insearch .first { padding-top: 0; } diff --git a/themes/default/layout.html.php b/themes/default/layout.html.php index bbb8ef8..754f78a 100644 --- a/themes/default/layout.html.php +++ b/themes/default/layout.html.php @@ -4,9 +4,7 @@ <?php echo $title;?> - - - + diff --git a/themes/logs/404-search.html.php b/themes/logs/404-search.html.php index ce5ebff..5d9c8cc 100644 --- a/themes/logs/404-search.html.php +++ b/themes/logs/404-search.html.php @@ -1,12 +1,21 @@ - - - -
-
-

Search results not found!

-

Please search again, or would you like to try our homepage instead?

-
- -
+ + + + + + + + Search results not found! - <?php echo blog_title() ?> + + + + +
+

Search results not found!

+
+
+

Please search again, or would you like to try our homepage instead?

+ + \ No newline at end of file diff --git a/themes/logs/404.html.php b/themes/logs/404.html.php index a924680..2be0476 100644 --- a/themes/logs/404.html.php +++ b/themes/logs/404.html.php @@ -1,10 +1,18 @@ - - - -
-
-

This page doesn't exist!

-

Please search to find what you're looking for or visit our homepage instead.

- -
-
\ No newline at end of file + + + + + + + + 404 Not Found - <?php echo blog_title() ?> + + + + +
+

This page doesn't exist!

+

Would you like to try our homepage instead?

+
+ + \ No newline at end of file diff --git a/themes/logs/css/style.css b/themes/logs/css/style.css index bb02d41..a43f21b 100644 --- a/themes/logs/css/style.css +++ b/themes/logs/css/style.css @@ -332,10 +332,6 @@ ul li, ol li { #search-form { float: right; } -.error-404 .post #search-form, -.error-404-search .post #search-form { - float: none; -} .search-input { border: 1px solid #E5E5E5; diff --git a/themes/logs/layout.html.php b/themes/logs/layout.html.php index 056e6ad..966988c 100644 --- a/themes/logs/layout.html.php +++ b/themes/logs/layout.html.php @@ -4,9 +4,7 @@ <?php echo $title;?> - - - +