Update search page display

This commit is contained in:
Hypolite Petovan 2017-05-04 21:33:44 -04:00
parent a35dab70b8
commit 9af47634e3
4 changed files with 35 additions and 40 deletions

View file

@ -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 ",

View file

@ -7,18 +7,15 @@
</div>
<div class="search-results">
<h3>Results for "<?php echo $query; ?>" (<?php echo $total; ?>)</h3>
<div class="profiles">
<?php if (count($results)): ?>
<h3>Results for "<?php echo $query; ?>" (<?php echo $total; ?>)</h3>
<?php
foreach ($results as $profile)
echo $this->view('_profile', array('profile'=>$profile));
echo $this->paginate();
foreach ($results as $profile) {
echo $this->view('_profile', array('profile' => $profile));
}
?>
@ -27,6 +24,6 @@
<h3>There were no results</h3>
<?php endif ?>
</div>
<?php echo $this->paginate();?>
</div>

View file

@ -5,13 +5,11 @@ $finding
<div id="forum-link"><a href="$forum">$toggle</a></div>
<div id="alpha-link"><a href="$alink">$alpha</a></div>
<div id="directory-search-wrapper">
<form id="directory-search-form" action="directory$args" method="get" >
<input type="text" name="search" id="directory-search" class="search-input" onfocus="this.select();" value="$search" />
<input type="submit" name="submit" id="directory-search-submit" value="$submit" />
<input type="submit" name="submit" id="directory-search-clear" value="$clear" />
</form>
<form id="directory-search-form" action="search$args" method="get" >
<input type="text" name="query" id="directory-search" class="search-input" onfocus="this.select();" value="$search" />
<button type="submit" name="submit" id="directory-search-submit" value="submit" >$submit</button>
lear">$clear</button>
</form>
</div>
<div id="directory-search-end"></div>