mirror of
https://github.com/danpros/htmly.git
synced 2026-04-18 19:46:21 +05:30
Add tag cloud widget.
Add tag cloud widget and various style changes for better look.
This commit is contained in:
parent
d84bfb48fd
commit
92c8168e09
5 changed files with 46 additions and 12 deletions
|
|
@ -27,7 +27,7 @@ Credit
|
|||
------
|
||||
|
||||
People who give references and inspiration for HTMLy:
|
||||
* [Martin Angelov](https://github.com/martinaglv)
|
||||
* [Martin Angelov](http://tutorialzine.com)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -316,6 +316,7 @@ function archive_list() {
|
|||
# Most recent year first
|
||||
krsort($by_year);
|
||||
# Iterate for display
|
||||
echo '<h3>Archive</h3>';
|
||||
foreach ($by_year as $year => $months){
|
||||
|
||||
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){
|
||||
$name = date('F', mktime(0,0,0,$month,1,2010));
|
||||
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>';
|
||||
}
|
||||
|
||||
|
|
@ -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
|
||||
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();
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
<div class="social"><?php echo social() ?></div>
|
||||
<?php if (menu() == true):?><div class="menu"><?php echo menu() ?></div><?php endif;?>
|
||||
<div class="archive"><?php echo archive_list()?></div>
|
||||
<div class="tagcloud"><?php echo tag_cloud()?></div>
|
||||
<div class="copyright"><?php echo copyright() ?></div>
|
||||
</aside>
|
||||
<section id="content">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue