Browse Source

Add author info

Add author info on post.
pull/9/head
Danang Probo Sayekti 12 years ago
parent
commit
350133e7c3
8 changed files with 78 additions and 43 deletions
  1. +11
    -8
      system/htmly.php
  2. +4
    -4
      system/includes/functions.php
  3. +2
    -2
      themes/default/404-search.html.php
  4. +53
    -24
      themes/default/css/style.css
  5. +2
    -2
      themes/default/layout.html.php
  6. +1
    -1
      themes/default/main.html.php
  7. +4
    -1
      themes/default/post.html.php
  8. +1
    -1
      themes/default/profile.html.php

+ 11
- 8
system/htmly.php View File

@ -59,13 +59,13 @@ get('/tag/:tag',function($tag){
} }
render('main',array( render('main',array(
'title' => 'Tag - ' . $tag .' - ' . config('blog.title'),
'title' => 'Posts tagged: ' . $tag .' - ' . config('blog.title'),
'page' => $page, 'page' => $page,
'posts' => $posts, 'posts' => $posts,
'canonical' => config('site.url') . '/tag/' . $tag, 'canonical' => config('site.url') . '/tag/' . $tag,
'description' => 'All posts tagged ' . $tag . ' on '. config('blog.title') . '.', 'description' => 'All posts tagged ' . $tag . ' on '. config('blog.title') . '.',
'bodyclass' => 'intag', 'bodyclass' => 'intag',
'breadcrumb' => '<a href="' . config('site.url') . '">Home</a> &#187; Posts tagged ' . $tag,
'breadcrumb' => '<a href="' . config('site.url') . '">Home</a> &#187; Posts tagged: ' . $tag,
'pagination' => has_pagination($total, $perpage, $page) 'pagination' => has_pagination($total, $perpage, $page)
)); ));
}); });
@ -108,13 +108,13 @@ get('/archive/:req',function($req){
} }
render('main',array( render('main',array(
'title' => 'Archive - ' . $timestamp .' - ' . config('blog.title'),
'title' => 'Archive for: ' . $timestamp .' - ' . config('blog.title'),
'page' => $page, 'page' => $page,
'posts' => $posts, 'posts' => $posts,
'canonical' => config('site.url') . '/archive/' . $req, 'canonical' => config('site.url') . '/archive/' . $req,
'description' => 'Archive page for ' . $timestamp . ' on ' . config('blog.title') . '.',
'description' => 'Archive page for: ' . $timestamp . ' on ' . config('blog.title') . '.',
'bodyclass' => 'inarchive', 'bodyclass' => 'inarchive',
'breadcrumb' => '<a href="' . config('site.url') . '">Home</a> &#187; Archive for ' . $timestamp,
'breadcrumb' => '<a href="' . config('site.url') . '">Home</a> &#187; Archive for: ' . $timestamp,
'pagination' => has_pagination($total, $perpage, $page) 'pagination' => has_pagination($total, $perpage, $page)
)); ));
}); });
@ -130,6 +130,8 @@ get('/:year/:month/:name', function($year, $month, $name){
not_found(); not_found();
} }
$bio = find_bio($current->author);
if (array_key_exists('prev', $post)) { if (array_key_exists('prev', $post)) {
$prev = $post['prev']; $prev = $post['prev'];
} }
@ -147,6 +149,7 @@ get('/:year/:month/:name', function($year, $month, $name){
render('post',array( render('post',array(
'title' => $current->title .' - ' . config('blog.title'), 'title' => $current->title .' - ' . config('blog.title'),
'p' => $current, 'p' => $current,
'authorinfo' => '<div class="author-info"><div class="separator">&rarr;</div><h4><strong>by ' . $bio->title . '</strong></h4>' . $bio->body . '</div>',
'canonical' => $current->url, 'canonical' => $current->url,
'description' => $description = get_description($current->body), 'description' => $description = get_description($current->body),
'bodyclass' => 'inpost', 'bodyclass' => 'inpost',
@ -178,7 +181,7 @@ get('/search/:keyword', function($keyword){
} }
render('main',array( render('main',array(
'title' => 'Search - ' . $keyword . ' - ' . config('blog.title'),
'title' => 'Search results for: ' . $keyword . ' - ' . config('blog.title'),
'page' => $page, 'page' => $page,
'posts' => $posts, 'posts' => $posts,
'canonical' => config('site.url') . '/search/' . $keyword, 'canonical' => config('site.url') . '/search/' . $keyword,
@ -231,7 +234,7 @@ get('/author/:profile',function($profile){
} }
render('profile',array( render('profile',array(
'title' => 'Author - '. $bio->title .' - ' . config('blog.title'),
'title' => 'Profile for: '. $bio->title .' - ' . config('blog.title'),
'page' => $page, 'page' => $page,
'posts' => $posts, 'posts' => $posts,
'bio' => $bio->body, 'bio' => $bio->body,
@ -239,7 +242,7 @@ get('/author/:profile',function($profile){
'canonical' => config('site.url') . '/author/' . $profile, 'canonical' => config('site.url') . '/author/' . $profile,
'description' => 'Profile page and all posts by ' . $bio->title . ' on ' . config('blog.title') . '.', 'description' => 'Profile page and all posts by ' . $bio->title . ' on ' . config('blog.title') . '.',
'bodyclass' => 'inprofile', 'bodyclass' => 'inprofile',
'breadcrumb' => '<a href="' . config('site.url') . '">Home</a> &#187; Profile page for ' . $bio->title,
'breadcrumb' => '<a href="' . config('site.url') . '">Home</a> &#187; Profile for: ' . $bio->title,
'pagination' => has_pagination($total, $perpage, $page) 'pagination' => has_pagination($total, $perpage, $page)
)); ));
}); });


+ 4
- 4
system/includes/functions.php View File

@ -660,13 +660,13 @@ function has_pagination($total, $perpage, $page = 1){
function get_description($text) { function get_description($text) {
$string = explode('</p>', $text); $string = explode('</p>', $text);
$string = preg_replace('@[\s]{2,}@',' ', strip_tags($string[0] . '</p>'));
$string = preg_replace('/[^,;a-zA-Z0-9_-]|[,;]$/s', ' ', strip_tags($string[0] . '</p>'));
if (strlen($string) > 1) { if (strlen($string) > 1) {
return $string; return $string;
} }
else { else {
$string = preg_replace('@[\s]{2,}@',' ', strip_tags($text));
$string = preg_replace('/[^,;a-zA-Z0-9_-]|[,;]$/s', ' ', strip_tags($text));
if (strlen($string) < config('description.char')) { if (strlen($string) < config('description.char')) {
return $string; return $string;
} }
@ -681,12 +681,12 @@ function get_description($text) {
function get_teaser($text, $url) { function get_teaser($text, $url) {
if (strlen(strip_tags($text)) < config('teaser.char')) { if (strlen(strip_tags($text)) < config('teaser.char')) {
$string = preg_replace('@[\s]{2,}@',' ', strip_tags($text));
$string = preg_replace('/[^,;a-zA-Z0-9_-]|[,;]$/s', ' ', strip_tags($text));
$body = $string . '...' . ' <a class="readmore" href="' . $url . '#more">more</a>' ; $body = $string . '...' . ' <a class="readmore" href="' . $url . '#more">more</a>' ;
echo '<p>' . $body . '</p>'; echo '<p>' . $body . '</p>';
} }
else { else {
$string = preg_replace('@[\s]{2,}@',' ', strip_tags($text));
$string = preg_replace('/[^,;a-zA-Z0-9_-]|[,;]$/s', ' ', strip_tags($text));
$string = substr($string, 0, strpos($string, ' ', config('teaser.char'))); $string = substr($string, 0, strpos($string, ' ', config('teaser.char')));
$body = $string . '...' . ' <a class="readmore" href="' . $url . '#more">more</a>' ; $body = $string . '...' . ' <a class="readmore" href="' . $url . '#more">more</a>' ;
echo '<p>' . $body . '</p>'; echo '<p>' . $body . '</p>';


+ 2
- 2
themes/default/404-search.html.php View File

@ -18,10 +18,10 @@
<h1>Search results not found!</h1> <h1>Search results not found!</h1>
<div class="search"> <div class="search">
<form id="search-form" method="get"> <form id="search-form" method="get">
<input type="text" class="search-input" name="keyword" value="Search..." onfocus="if (this.value == 'Search...') {this.value = '';}" onblur="if (this.value == '') {this.value = '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"> <input type="submit" value="Search" class="search-button">
</form> </form>
<?php if(isset($_GET['keyword'])) {$url = site_url() . 'search/' . $_GET['keyword']; header ("Location: $url");} ?>
<?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>


+ 53
- 24
themes/default/css/style.css View File

@ -51,13 +51,16 @@ img {
-----------------------------*/ -----------------------------*/
h1{ h1{
font: 20px 'Open Sans Condensed', sans-serif;
margin-bottom: 1em;
line-height: 1.3;
font: 28px 'Open Sans Condensed', sans-serif;
line-height: 1.2;
margin: 0.5em 0;
} }
h1.blog-title { h1.blog-title {
text-transform:uppercase; text-transform:uppercase;
font: 20px 'Open Sans Condensed', sans-serif;
margin-bottom: 1em;
line-height: 1.3;
} }
h1.blog-title a { h1.blog-title a {
@ -69,50 +72,57 @@ h1.blog-title a:hover {
color: #389dc1; color: #389dc1;
} }
h1.title-post, h2.title-index{
font: 28px 'Open Sans Condensed', sans-serif;
line-height: 1.2;
text-transform:normal;
margin:0 0 20px 0;
}
h1.title-post a, h2.title-index a{
color:#4f4f4f;
text-decoration: none;
}
h1.title-post a:hover, h2.title-index a:hover {
color: #389dc1;
}
h2{ h2{
font: 22px 'Open Sans Condensed', sans-serif; font: 22px 'Open Sans Condensed', sans-serif;
line-height: 1.2; line-height: 1.2;
margin-bottom: 0.5em;
margin: 0.5em 0;
}
h2.title-index{
font: 28px 'Open Sans Condensed', sans-serif;
line-height: 1.2;
text-transform:normal;
margin:0 0 20px 0;
} }
h3{ h3{
font: 18px 'Open Sans Condensed', sans-serif; font: 18px 'Open Sans Condensed', sans-serif;
line-height: 1.2; line-height: 1.2;
margin-bottom: 0.5em;
margin: 0.5em 0;
} }
h4{ h4{
font: 16px 'Open Sans Condensed', sans-serif; font: 16px 'Open Sans Condensed', sans-serif;
line-height: 1.2; line-height: 1.2;
margin-bottom: 0.5em;
margin: 0.5em 0;
} }
h5{ h5{
font: 14px 'Open Sans Condensed', sans-serif; font: 14px 'Open Sans Condensed', sans-serif;
line-height: 1.2; line-height: 1.2;
margin-bottom: 0.5em;
margin: 0.5em 0;
} }
h6{ h6{
font: 12px 'Open Sans Condensed', sans-serif; font: 12px 'Open Sans Condensed', sans-serif;
line-height: 1.2; line-height: 1.2;
margin-bottom: 0.5em;
}
h1.title-post, h2.title-index{
font: 28px 'Open Sans Condensed', sans-serif;
line-height: 1.2;
text-transform:normal;
margin:0 0 20px 0;
}
h1.title-post a, h2.title-index a{
color:#4f4f4f;
text-decoration: none;
}
h1.title-post a:hover, h2.title-index a:hover {
color: #389dc1;
margin: 0.5em 0;
} }
/*---------------------------- /*----------------------------
@ -161,6 +171,10 @@ h1.title-post a:hover, h2.title-index a:hover {
text-decoration:none; text-decoration:none;
} }
.body {
min-height: 90px;
}
.infront .post, .intag .post, .inarchive .post, .insearch .post, .inprofile .post{ .infront .post, .intag .post, .inarchive .post, .insearch .post, .inprofile .post{
border-bottom: 1px solid #dfdfdf; border-bottom: 1px solid #dfdfdf;
padding: 30px 0 10px 0; padding: 30px 0 10px 0;
@ -541,6 +555,21 @@ aside .copyright p{
font-size: 12px; font-size: 12px;
} }
/*----------------------------
Author info
-----------------------------*/
.author-info {
font-size: 12px;
font-style:italic;
}
.separator {
text-align:left;
font-size: 18px;
line-height: 1;
}
/*---------------------------- /*----------------------------
Media queries Media queries
-----------------------------*/ -----------------------------*/


+ 2
- 2
themes/default/layout.html.php View File

@ -27,10 +27,10 @@
<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"> <form id="search-form" method="get">
<input type="text" class="search-input" name="keyword" value="Search..." onfocus="if (this.value == 'Search...') {this.value = '';}" onblur="if (this.value == '') {this.value = '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"> <input type="submit" value="Search" class="search-button">
</form> </form>
<?php if(isset($_GET['keyword'])) {$url = site_url() . 'search/' . $_GET['keyword']; header ("Location: $url");} ?>
<?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>
<?php if (menu() == true):?><div class="menu"><?php echo menu() ?></div><?php endif;?> <?php if (menu() == true):?><div class="menu"><?php echo menu() ?></div><?php endif;?>


+ 1
- 1
themes/default/main.html.php View File

@ -17,7 +17,7 @@
<div class="main"> <div class="main">
<h2 class="title-index" itemprop="name"><a href="<?php echo $p->url?>"><?php echo $p->title ?></a></h2> <h2 class="title-index" itemprop="name"><a href="<?php echo $p->url?>"><?php echo $p->title ?></a></h2>
<div class="date"><span itemprop="datePublished"><?php echo date('d F Y', $p->date)?></span> - Posted in <span itemprop="articleSection"><a href="<?php echo $p->tagurl ?>"><?php echo $p->tag ?></a></span> by <span itemprop="author"><a href="<?php echo $p->authorurl ?>"><?php echo $p->author ?></a></span><?php if (disqus_count() == true):?> - <span><a href="<?php echo $p->url?>#disqus_thread">Comments</a></span><?php endif;?></div> <div class="date"><span itemprop="datePublished"><?php echo date('d F Y', $p->date)?></span> - Posted in <span itemprop="articleSection"><a href="<?php echo $p->tagurl ?>"><?php echo $p->tag ?></a></span> by <span itemprop="author"><a href="<?php echo $p->authorurl ?>"><?php echo $p->author ?></a></span><?php if (disqus_count() == true):?> - <span><a href="<?php echo $p->url?>#disqus_thread">Comments</a></span><?php endif;?></div>
<div itemprop="articleBody">
<div class="body" itemprop="articleBody">
<?php if (config('img.thumbnail') == 'true'):?> <?php if (config('img.thumbnail') == 'true'):?>
<?php echo get_thumbnail($p->body)?> <?php echo get_thumbnail($p->body)?>
<?php endif;?> <?php endif;?>


+ 4
- 1
themes/default/post.html.php View File

@ -8,10 +8,13 @@
<?php if ($type == 'blogpost'):?> <?php if ($type == 'blogpost'):?>
<div class="date"><span itemprop="datePublished"><a href="<?php echo $p->archive ?>" title="Show all posts made on this day"><?php echo date('d F Y', $p->date)?></a></span> - Posted in <span itemprop="articleSection"><a href="<?php echo $p->tagurl ?>"><?php echo $p->tag ?></a></span> by <span itemprop="author"><a href="<?php echo $p->authorurl ?>"><?php echo $p->author ?></a></span> - <span><a href="<?php echo $p->url ?>" rel="permalink">Permalink</a></span></div> <div class="date"><span itemprop="datePublished"><a href="<?php echo $p->archive ?>" title="Show all posts made on this day"><?php echo date('d F Y', $p->date)?></a></span> - Posted in <span itemprop="articleSection"><a href="<?php echo $p->tagurl ?>"><?php echo $p->tag ?></a></span> by <span itemprop="author"><a href="<?php echo $p->authorurl ?>"><?php echo $p->author ?></a></span> - <span><a href="<?php echo $p->url ?>" rel="permalink">Permalink</a></span></div>
<?php endif;?> <?php endif;?>
<div itemprop="articleBody">
<div class="body" itemprop="articleBody">
<?php echo $p->body; ?> <?php echo $p->body; ?>
</div> </div>
</div> </div>
<?php if (config('author.info') == 'true'):?>
<?php echo $authorinfo ?>
<?php endif;?>
<div class="comments border"> <div class="comments border">
<?php if ($type == 'blogpost'):?> <?php if ($type == 'blogpost'):?>
<?php if (disqus(null, null) == true):?> <?php if (disqus(null, null) == true):?>


+ 1
- 1
themes/default/profile.html.php View File

@ -20,7 +20,7 @@
$i++; $i++;
?> ?>
<li> <li>
<span><a href="<?php echo $p->url?>"><?php echo $p->title ?></a></span> on <span><?php echo date('d F Y', $p->date)?></span> - Posted in <span><a href="<?php echo $p->tagurl ?>"><?php echo ucfirst($p->tag) ?></a></span>
<span><a href="<?php echo $p->url?>"><?php echo $p->title ?></a></span> on <span><?php echo date('d F Y', $p->date)?></span> - Posted in <span><a href="<?php echo $p->tagurl ?>"><?php echo $p->tag ?></a></span>
</li> </li>
<?php endforeach;?> <?php endforeach;?>
</ul> </ul>


Loading…
Cancel
Save