From 9af47634e32b2b9c587c01f83ad1c803322f18ba Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 4 May 2017 21:33:44 -0400 Subject: [PATCH] Update search page display --- assets/style.css | 28 ++++++++++++++-------------- mod/search.php | 10 +++++----- src/templates/view/search.php | 25 +++++++++++-------------- view/directory_header.tpl | 12 +++++------- 4 files changed, 35 insertions(+), 40 deletions(-) diff --git a/assets/style.css b/assets/style.css index e91c7c5f..89f9b778 100644 --- a/assets/style.css +++ b/assets/style.css @@ -267,15 +267,15 @@ nav#links a, /* smaller than tablet in portrait */ @media screen and (max-width: 880px){ - + body{ overflow-x:hidden; } - + .mobile{ display:inherit !important; } - + #top-bar .header{ overflow:hidden; width:0px; @@ -283,14 +283,14 @@ nav#links a, height:28px; background-size:28px; } - + #top-bar .search-form{ display:block; width:100%; padding:0 35px; margin:0; } - + .homepage-wrapper, .search-wrapper{ width:95%; @@ -299,17 +299,17 @@ nav#links a, .homepage-wrapper .search-wrapper{ width:100%; } - + .homepage-wrapper{ margin:90px auto; } - + .search-results, .sub-menu-outer .sub-menu-inner{ width:95%; max-width:500px; } - + .hamburger{ position:absolute; top:0px; @@ -319,7 +319,7 @@ nav#links a, line-height:22px; cursor:pointer; } - + nav#links{ position:absolute; width:100%; @@ -355,14 +355,14 @@ nav#links a, line-height:2.5em; margin:4px 0; } - + .profile, .profile .profile-info{ overflow-wrap:break-word; word-wrap:break-word; overflow:hidden; } - + } /* The moment the header starts getting squashed */ @@ -381,7 +381,7 @@ nav#links a, /* close to mobile in portrait */ @media screen and (max-width: 400px){ - + .profile .profile-photo{ width:60px; border-radius:11.25px; @@ -390,5 +390,5 @@ nav#links a, .profile .profile-info .url{ display:none; } - -} \ No newline at end of file + +} diff --git a/mod/search.php b/mod/search.php index 6240e62f..9847f14b 100644 --- a/mod/search.php +++ b/mod/search.php @@ -51,10 +51,10 @@ function search_content(App $a) } $sql_extra = ((strlen($search)) ? " AND MATCH (`name`, `pdesc`, `homepage`, `locality`, `region`, `country-name`, `tags` ) - AGAINST ('$search' IN BOOLEAN MODE) " : ""); + AGAINST ('$search' IN BOOLEAN MODE) " : ''); if (!is_null($community)) { - $sql_extra .= " and comm=" . intval($community) . " "; + $sql_extra .= ' AND `comm` = ' . intval($community) . ' '; } $sql_extra = str_replace('%', '%%', $sql_extra); @@ -63,13 +63,13 @@ function search_content(App $a) $r = q("SELECT COUNT(*) AS `total` FROM `profile` WHERE `censored` = 0 $sql_extra "); if (count($r)) { $total = $r[0]['total']; - $a->set_pager_total($r[0]['total']); + $a->set_pager_total($total); } if ($alpha) { - $order = " order by name asc "; + $order = ' ORDER BY `name` ASC '; } else { - $order = " order by updated desc, id desc "; + $order = ' ORDER BY `updated` DESC, `id` DESC '; } $r = q("SELECT * FROM `profile` WHERE `censored` = 0 $sql_extra $order LIMIT %d , %d ", diff --git a/src/templates/view/search.php b/src/templates/view/search.php index 2d2b0fb2..f3cc544d 100644 --- a/src/templates/view/search.php +++ b/src/templates/view/search.php @@ -7,26 +7,23 @@
+

Results for "" ()

- - -

Results for "" ()

+ view('_profile', array('profile'=>$profile)); - - echo $this->paginate(); - + + foreach ($results as $profile) { + echo $this->view('_profile', array('profile' => $profile)); + } ?> - - + + - +

There were no results

- + -
+ paginate();?>
diff --git a/view/directory_header.tpl b/view/directory_header.tpl index 1ac049a3..2431a5c4 100644 --- a/view/directory_header.tpl +++ b/view/directory_header.tpl @@ -5,13 +5,11 @@ $finding -
-
- - - -
+
+ + +lear">$clear +
-