mirror of
https://github.com/danpros/htmly.git
synced 2026-04-22 13:36:22 +05:30
Search form + perfomance
Improve search form + perfomance.
This commit is contained in:
parent
7deab5e802
commit
f51f27d4d9
6 changed files with 28 additions and 33 deletions
|
|
@ -511,11 +511,8 @@ function get_bio($names, $author){
|
||||||
|
|
||||||
$post = new stdClass;
|
$post = new stdClass;
|
||||||
|
|
||||||
// Extract the array
|
|
||||||
$arr = explode('_', $v);
|
|
||||||
|
|
||||||
// Replaced string
|
// Replaced string
|
||||||
$replaced = substr($arr[0], 0,strrpos($arr[0], '/')) . '/';
|
$replaced = substr($v, 0,strrpos($v, '/')) . '/';
|
||||||
|
|
||||||
// Author string
|
// Author string
|
||||||
$str = explode('/', $replaced);
|
$str = explode('/', $replaced);
|
||||||
|
|
@ -523,7 +520,7 @@ function get_bio($names, $author){
|
||||||
|
|
||||||
if($author === $profile){
|
if($author === $profile){
|
||||||
// Profile URL
|
// Profile URL
|
||||||
$url = str_replace($replaced,'',$arr[0]);
|
$url = str_replace($replaced,'',$v);
|
||||||
$post->url = site_url() . 'author/' . $profile;
|
$post->url = site_url() . 'author/' . $profile;
|
||||||
|
|
||||||
// Get the contents and convert it to HTML
|
// Get the contents and convert it to HTML
|
||||||
|
|
@ -849,7 +846,21 @@ function menu(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Auto generated menu from static page
|
// Menu
|
||||||
|
function search() {
|
||||||
|
echo <<<EOF
|
||||||
|
<form id="search-form" method="get">
|
||||||
|
<input type="text" class="search-input" name="search" value="Search" onfocus="if (this.value == 'Search') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search';}">
|
||||||
|
<input type="submit" value="Search" class="search-button">
|
||||||
|
</form>
|
||||||
|
EOF;
|
||||||
|
if(isset($_GET['search'])) {
|
||||||
|
$url = site_url() . 'search/' . $_GET['search'];
|
||||||
|
header ("Location: $url");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Auto generate menu from static page
|
||||||
function get_menu() {
|
function get_menu() {
|
||||||
|
|
||||||
$posts = get_spage_names();
|
$posts = get_spage_names();
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,7 @@
|
||||||
<div class="center message">
|
<div class="center message">
|
||||||
<h1>Search results not found!</h1>
|
<h1>Search results not found!</h1>
|
||||||
<div class="search">
|
<div class="search">
|
||||||
<form id="search-form" method="get">
|
<?php echo search() ?>
|
||||||
<input type="text" class="search-input" name="search" value="Search..." onfocus="if (this.value == 'Search...') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search...';}">
|
|
||||||
<input type="submit" value="Search" class="search-button">
|
|
||||||
</form>
|
|
||||||
<?php if(isset($_GET['search'])) {$url = site_url() . 'search/' . $_GET['search']; header ("Location: $url");} ?>
|
|
||||||
</div>
|
</div>
|
||||||
<p>Please search again, or would you like to try our <a href="<?php echo site_url() ?>">homepage</a> instead?</p>
|
<p>Please search again, or would you like to try our <a href="<?php echo site_url() ?>">homepage</a> instead?</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -25,11 +25,7 @@
|
||||||
<h1 class="blog-title"><a href="<?php echo site_url() ?>"><?php echo config('blog.title') ?></a></h1>
|
<h1 class="blog-title"><a href="<?php echo site_url() ?>"><?php echo config('blog.title') ?></a></h1>
|
||||||
<div class="description"><p><?php echo config('blog.description')?></p></div>
|
<div class="description"><p><?php echo config('blog.description')?></p></div>
|
||||||
<div class="search">
|
<div class="search">
|
||||||
<form id="search-form" method="get">
|
<?php echo search() ?>
|
||||||
<input type="text" class="search-input" name="search" value="Search..." onfocus="if (this.value == 'Search...') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search...';}">
|
|
||||||
<input type="submit" value="Search" class="search-button">
|
|
||||||
</form>
|
|
||||||
<?php if(isset($_GET['search'])) {$url = site_url() . 'search/' . $_GET['search']; header ("Location: $url");} ?>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="social"><?php echo social() ?></div>
|
<div class="social"><?php echo social() ?></div>
|
||||||
<div class="menu"><?php echo menu() ?></div>
|
<div class="menu"><?php echo menu() ?></div>
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,7 @@
|
||||||
<div class="center message">
|
<div class="center message">
|
||||||
<h1>Search results not found!</h1>
|
<h1>Search results not found!</h1>
|
||||||
<div class="search-404">
|
<div class="search-404">
|
||||||
<form id="search-form-404" method="get">
|
<?php echo search() ?>
|
||||||
<input type="text" class="search-input" name="search" value="Search..." onfocus="if (this.value == 'Search...') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search...';}">
|
|
||||||
<input type="submit" value="Search" class="search-button">
|
|
||||||
</form>
|
|
||||||
<?php if(isset($_GET['search'])) {$url = site_url() . 'search/' . $_GET['search']; header ("Location: $url");} ?>
|
|
||||||
</div>
|
</div>
|
||||||
<p>Please search again, or would you like to try our <a href="<?php echo site_url() ?>">homepage</a> instead?</p>
|
<p>Please search again, or would you like to try our <a href="<?php echo site_url() ?>">homepage</a> instead?</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -596,7 +596,7 @@ h1.title-post a:hover, h2.title-index a:hover {
|
||||||
margin-bottom: 1.2em;
|
margin-bottom: 1.2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
#search-form-404 {
|
.search-404 #search-form {
|
||||||
float:none;
|
float:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,11 +26,7 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<nav id="menu">
|
<nav id="menu">
|
||||||
<?php echo menu() ?>
|
<?php echo menu() ?>
|
||||||
<form id="search-form" method="get">
|
<?php echo search() ?>
|
||||||
<input type="text" class="search-input" name="search" value="Search..." onfocus="if (this.value == 'Search...') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search...';}">
|
|
||||||
<input type="submit" value="Search" class="search-button">
|
|
||||||
</form>
|
|
||||||
<?php if(isset($_GET['search'])) {$url = site_url() . 'search/' . $_GET['search']; header ("Location: $url");} ?>
|
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue