From 350133e7c3332ab2f55bb3d2258ddc003761457f Mon Sep 17 00:00:00 2001 From: Danang Probo Sayekti Date: Wed, 8 Jan 2014 12:29:04 +0700 Subject: [PATCH] Add author info Add author info on post. --- system/htmly.php | 19 ++++++---- system/includes/functions.php | 8 ++-- themes/default/404-search.html.php | 4 +- themes/default/css/style.css | 77 ++++++++++++++++++++++++++------------ themes/default/layout.html.php | 4 +- themes/default/main.html.php | 2 +- themes/default/post.html.php | 5 ++- themes/default/profile.html.php | 2 +- 8 files changed, 78 insertions(+), 43 deletions(-) diff --git a/system/htmly.php b/system/htmly.php index d207797..c2cb4a5 100644 --- a/system/htmly.php +++ b/system/htmly.php @@ -59,13 +59,13 @@ get('/tag/:tag',function($tag){ } render('main',array( - 'title' => 'Tag - ' . $tag .' - ' . config('blog.title'), + 'title' => 'Posts tagged: ' . $tag .' - ' . config('blog.title'), 'page' => $page, 'posts' => $posts, 'canonical' => config('site.url') . '/tag/' . $tag, 'description' => 'All posts tagged ' . $tag . ' on '. config('blog.title') . '.', 'bodyclass' => 'intag', - 'breadcrumb' => 'Home » Posts tagged ' . $tag, + 'breadcrumb' => 'Home » Posts tagged: ' . $tag, 'pagination' => has_pagination($total, $perpage, $page) )); }); @@ -108,13 +108,13 @@ get('/archive/:req',function($req){ } render('main',array( - 'title' => 'Archive - ' . $timestamp .' - ' . config('blog.title'), + 'title' => 'Archive for: ' . $timestamp .' - ' . config('blog.title'), 'page' => $page, 'posts' => $posts, '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', - 'breadcrumb' => 'Home » Archive for ' . $timestamp, + 'breadcrumb' => 'Home » Archive for: ' . $timestamp, 'pagination' => has_pagination($total, $perpage, $page) )); }); @@ -130,6 +130,8 @@ get('/:year/:month/:name', function($year, $month, $name){ not_found(); } + $bio = find_bio($current->author); + if (array_key_exists('prev', $post)) { $prev = $post['prev']; } @@ -147,6 +149,7 @@ get('/:year/:month/:name', function($year, $month, $name){ render('post',array( 'title' => $current->title .' - ' . config('blog.title'), 'p' => $current, + 'authorinfo' => '

by ' . $bio->title . '

' . $bio->body . '
', 'canonical' => $current->url, 'description' => $description = get_description($current->body), 'bodyclass' => 'inpost', @@ -178,7 +181,7 @@ get('/search/:keyword', function($keyword){ } render('main',array( - 'title' => 'Search - ' . $keyword . ' - ' . config('blog.title'), + 'title' => 'Search results for: ' . $keyword . ' - ' . config('blog.title'), 'page' => $page, 'posts' => $posts, 'canonical' => config('site.url') . '/search/' . $keyword, @@ -231,7 +234,7 @@ get('/author/:profile',function($profile){ } render('profile',array( - 'title' => 'Author - '. $bio->title .' - ' . config('blog.title'), + 'title' => 'Profile for: '. $bio->title .' - ' . config('blog.title'), 'page' => $page, 'posts' => $posts, 'bio' => $bio->body, @@ -239,7 +242,7 @@ get('/author/:profile',function($profile){ 'canonical' => config('site.url') . '/author/' . $profile, 'description' => 'Profile page and all posts by ' . $bio->title . ' on ' . config('blog.title') . '.', 'bodyclass' => 'inprofile', - 'breadcrumb' => 'Home » Profile page for ' . $bio->title, + 'breadcrumb' => 'Home » Profile for: ' . $bio->title, 'pagination' => has_pagination($total, $perpage, $page) )); }); diff --git a/system/includes/functions.php b/system/includes/functions.php index 9378af5..dcaf85d 100644 --- a/system/includes/functions.php +++ b/system/includes/functions.php @@ -660,13 +660,13 @@ function has_pagination($total, $perpage, $page = 1){ function get_description($text) { $string = explode('

', $text); - $string = preg_replace('@[\s]{2,}@',' ', strip_tags($string[0] . '

')); + $string = preg_replace('/[^,;a-zA-Z0-9_-]|[,;]$/s', ' ', strip_tags($string[0] . '

')); if (strlen($string) > 1) { return $string; } 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')) { return $string; } @@ -681,12 +681,12 @@ function get_description($text) { function get_teaser($text, $url) { 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 . '...' . ' more' ; echo '

' . $body . '

'; } 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'))); $body = $string . '...' . ' more' ; echo '

' . $body . '

'; diff --git a/themes/default/404-search.html.php b/themes/default/404-search.html.php index 4af0df9..ef06950 100644 --- a/themes/default/404-search.html.php +++ b/themes/default/404-search.html.php @@ -18,10 +18,10 @@

Search results not found!

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

diff --git a/themes/default/css/style.css b/themes/default/css/style.css index a602169..66ddc42 100644 --- a/themes/default/css/style.css +++ b/themes/default/css/style.css @@ -51,13 +51,16 @@ img { -----------------------------*/ 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 { text-transform:uppercase; + font: 20px 'Open Sans Condensed', sans-serif; + margin-bottom: 1em; + line-height: 1.3; } h1.blog-title a { @@ -69,50 +72,57 @@ h1.blog-title a:hover { 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{ font: 22px 'Open Sans Condensed', sans-serif; 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{ font: 18px 'Open Sans Condensed', sans-serif; line-height: 1.2; - margin-bottom: 0.5em; + margin: 0.5em 0; } h4{ font: 16px 'Open Sans Condensed', sans-serif; line-height: 1.2; - margin-bottom: 0.5em; + margin: 0.5em 0; } h5{ font: 14px 'Open Sans Condensed', sans-serif; line-height: 1.2; - margin-bottom: 0.5em; + margin: 0.5em 0; } h6{ font: 12px 'Open Sans Condensed', sans-serif; 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; } +.body { + min-height: 90px; +} + .infront .post, .intag .post, .inarchive .post, .insearch .post, .inprofile .post{ border-bottom: 1px solid #dfdfdf; padding: 30px 0 10px 0; @@ -541,6 +555,21 @@ aside .copyright p{ 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 -----------------------------*/ diff --git a/themes/default/layout.html.php b/themes/default/layout.html.php index 1ad0fc2..b098414 100644 --- a/themes/default/layout.html.php +++ b/themes/default/layout.html.php @@ -27,10 +27,10 @@

diff --git a/themes/default/main.html.php b/themes/default/main.html.php index 8c24dc9..de06ba2 100644 --- a/themes/default/main.html.php +++ b/themes/default/main.html.php @@ -17,7 +17,7 @@

title ?>

- Posted in tag ?> by - Comments
-
+
body)?> diff --git a/themes/default/post.html.php b/themes/default/post.html.php index c3e2c1a..cb5bb2e 100644 --- a/themes/default/post.html.php +++ b/themes/default/post.html.php @@ -8,10 +8,13 @@ -
+
body; ?>
+ + +
diff --git a/themes/default/profile.html.php b/themes/default/profile.html.php index 362fedb..edff022 100644 --- a/themes/default/profile.html.php +++ b/themes/default/profile.html.php @@ -20,7 +20,7 @@ $i++; ?>
  • - title ?> on date)?> - Posted in tag) ?> + title ?> on date)?> - Posted in tag ?>