Browse Source

Add tag cloud widget.

Add tag cloud widget and various style changes for better look.
pull/4/merge
Danang Probo Sayekti 12 years ago
parent
commit
92c8168e09
5 changed files with 46 additions and 12 deletions
  1. +1
    -1
      README.md
  2. +1
    -1
      system/htmly.php
  3. +31
    -3
      system/includes/functions.php
  4. +12
    -7
      themes/default/css/style.css
  5. +1
    -0
      themes/default/layout.html.php

+ 1
- 1
README.md View File

@ -27,7 +27,7 @@ Credit
------ ------
People who give references and inspiration for HTMLy: People who give references and inspiration for HTMLy:
* [Martin Angelov](https://github.com/martinaglv)
* [Martin Angelov](http://tutorialzine.com)


+ 1
- 1
system/htmly.php View File

@ -218,7 +218,7 @@ get('/author/:profile',function($profile){
$perpage = config('profile.perpage'); $perpage = config('profile.perpage');
$posts = get_profile($profile); $posts = get_profile($profile);
$bio = bio($profile);
$bio = find_bio($profile);
$total = count($posts); $total = count($posts);


+ 31
- 3
system/includes/functions.php View File

@ -316,6 +316,7 @@ function archive_list() {
# Most recent year first # Most recent year first
krsort($by_year); krsort($by_year);
# Iterate for display # Iterate for display
echo '<h3>Archive</h3>';
foreach ($by_year as $year => $months){ foreach ($by_year as $year => $months){
echo '<span class="year"><a href="' . site_url() . 'archive/' . $year . '">' . $year . '</a></span> '; echo '<span class="year"><a href="' . site_url() . 'archive/' . $year . '">' . $year . '</a></span> ';
@ -328,7 +329,7 @@ function archive_list() {
foreach ($by_month as $month => $count){ foreach ($by_month as $month => $count){
$name = date('F', mktime(0,0,0,$month,1,2010)); $name = date('F', mktime(0,0,0,$month,1,2010));
echo '<li class="item"><a href="' . site_url() . 'archive/' . $year . '-' . $month . '">' . $name . '</a>'; echo '<li class="item"><a href="' . site_url() . 'archive/' . $year . '-' . $month . '">' . $name . '</a>';
echo ' (' . $count . ')</li>';
echo ' <span class="count">(' . $count . ')</span></li>';
echo '</li>'; echo '</li>';
} }
@ -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 '<h3>Tags</h3>';
echo '<ul class="taglist">';
foreach ($tag_collection as $tag => $count){
echo '<li class="item"><a href="' . site_url() . 'tag/' . $tag . '">' . $tag . '</a> <span class="count">(' . $count . ')</span></li>';
}
echo '</ul>';
}
// Return static page // Return static page
function get_spage($posts, $spage){ function get_spage($posts, $spage){
@ -497,8 +525,8 @@ function get_bio($names, $author){
return $tmp; return $tmp;
} }
// Find static page
function bio($author){
// Find author bio
function find_bio($author){
$names = get_author_names(); $names = get_author_names();


+ 12
- 7
themes/default/css/style.css View File

@ -286,6 +286,11 @@ aside .menu {
margin-bottom: 1.2em; margin-bottom: 1.2em;
} }
aside h3 {
font: normal 16px 'Open Sans Condensed', sans-serif;
text-transform: uppercase;
}
aside .menu ul{ aside .menu ul{
font: bold 18px 'Open Sans Condensed', sans-serif; font: bold 18px 'Open Sans Condensed', sans-serif;
text-transform: uppercase; text-transform: uppercase;
@ -299,14 +304,14 @@ aside .menu ul li a{
margin:2px 0 2px 10px; 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-bottom: 1.2em;
margin-left: 10px; margin-left: 10px;
} }
aside .archive ul li {
aside .archive ul li, aside .tagcloud ul li {
margin-left:30px; margin-left:30px;
} }
@ -316,7 +321,7 @@ aside .menu ul li a:hover{
} }
aside .copyright { aside .copyright {
padding-top:1.2em;
padding:1.2em 0 65px 0;
color: #888; color: #888;
font: 11px Georgia, sans-serif; font: 11px Georgia, sans-serif;
font-weight: normal; font-weight: normal;
@ -507,7 +512,7 @@ aside .copyright p{
} }
.post-list { .post-list {
padding-bottom:1.2em;
padding-bottom:2em;
border-bottom: solid 1px #dfdfdf; border-bottom: solid 1px #dfdfdf;
font-size: 12px; font-size: 12px;
} }
@ -560,7 +565,7 @@ aside .copyright p{
text-align: center; text-align: center;
} }
aside .archive, aside .copyright{
aside .archive, aside .tagcloud, aside .copyright{
display: none; display: none;
} }


+ 1
- 0
themes/default/layout.html.php View File

@ -35,6 +35,7 @@
<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;?>
<div class="archive"><?php echo archive_list()?></div> <div class="archive"><?php echo archive_list()?></div>
<div class="tagcloud"><?php echo tag_cloud()?></div>
<div class="copyright"><?php echo copyright() ?></div> <div class="copyright"><?php echo copyright() ?></div>
</aside> </aside>
<section id="content"> <section id="content">


Loading…
Cancel
Save