From 92c8168e096495f5803dfd3935e93c63ee36a19e Mon Sep 17 00:00:00 2001 From: Danang Probo Sayekti Date: Mon, 6 Jan 2014 10:51:18 +0700 Subject: [PATCH] Add tag cloud widget. Add tag cloud widget and various style changes for better look. --- README.md | 2 +- system/htmly.php | 2 +- system/includes/functions.php | 34 +++++++++++++++++++++++++++++++--- themes/default/css/style.css | 19 ++++++++++++------- themes/default/layout.html.php | 1 + 5 files changed, 46 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 0fb58a2..f631ac8 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Credit ------ People who give references and inspiration for HTMLy: -* [Martin Angelov](https://github.com/martinaglv) +* [Martin Angelov](http://tutorialzine.com) diff --git a/system/htmly.php b/system/htmly.php index d3e2381..28f25b0 100644 --- a/system/htmly.php +++ b/system/htmly.php @@ -218,7 +218,7 @@ get('/author/:profile',function($profile){ $perpage = config('profile.perpage'); $posts = get_profile($profile); - $bio = bio($profile); + $bio = find_bio($profile); $total = count($posts); diff --git a/system/includes/functions.php b/system/includes/functions.php index 478194d..eb1f7c3 100644 --- a/system/includes/functions.php +++ b/system/includes/functions.php @@ -316,6 +316,7 @@ function archive_list() { # Most recent year first krsort($by_year); # Iterate for display + echo '

Archive

'; foreach ($by_year as $year => $months){ echo '' . $year . ' '; @@ -328,7 +329,7 @@ function archive_list() { foreach ($by_month as $month => $count){ $name = date('F', mktime(0,0,0,$month,1,2010)); echo '
  • ' . $name . ''; - echo ' (' . $count . ')
  • '; + echo ' (' . $count . ')'; echo ''; } @@ -338,6 +339,33 @@ function archive_list() { } +// Return tag cloud +function tag_cloud() { + + $posts = get_post_names(); + $tags = array(); + + foreach($posts as $index => $v){ + + $arr = explode('_', $v); + + $data = $arr[1]; + $tags[] = $data; + + } + + $tag_collection = array_count_values($tags); + ksort($tag_collection); + + echo '

    Tags

    '; + echo ''; + +} + // Return static page function get_spage($posts, $spage){ @@ -497,8 +525,8 @@ function get_bio($names, $author){ return $tmp; } -// Find static page -function bio($author){ +// Find author bio +function find_bio($author){ $names = get_author_names(); diff --git a/themes/default/css/style.css b/themes/default/css/style.css index 9101192..564c5fb 100644 --- a/themes/default/css/style.css +++ b/themes/default/css/style.css @@ -286,6 +286,11 @@ aside .menu { margin-bottom: 1.2em; } +aside h3 { + font: normal 16px 'Open Sans Condensed', sans-serif; + text-transform: uppercase; +} + aside .menu ul{ font: bold 18px 'Open Sans Condensed', sans-serif; text-transform: uppercase; @@ -299,14 +304,14 @@ aside .menu ul li a{ margin:2px 0 2px 10px; } -aside .archive { - font-size: 15px; - font-family: 'Open Sans Condensed', sans-serif; +aside .archive, aside .tagcloud { + font-size: 14px; + font-family: Georgia, sans-serif; margin-bottom: 1.2em; margin-left: 10px; } -aside .archive ul li { +aside .archive ul li, aside .tagcloud ul li { margin-left:30px; } @@ -316,7 +321,7 @@ aside .menu ul li a:hover{ } aside .copyright { - padding-top:1.2em; + padding:1.2em 0 65px 0; color: #888; font: 11px Georgia, sans-serif; font-weight: normal; @@ -507,7 +512,7 @@ aside .copyright p{ } .post-list { - padding-bottom:1.2em; + padding-bottom:2em; border-bottom: solid 1px #dfdfdf; font-size: 12px; } @@ -560,7 +565,7 @@ aside .copyright p{ text-align: center; } - aside .archive, aside .copyright{ + aside .archive, aside .tagcloud, aside .copyright{ display: none; } diff --git a/themes/default/layout.html.php b/themes/default/layout.html.php index a3c5d20..1ad0fc2 100644 --- a/themes/default/layout.html.php +++ b/themes/default/layout.html.php @@ -35,6 +35,7 @@
    +