Browse Source

Add blog Url

pull/189/head
Danang Probo Sayekti 10 years ago
parent
commit
96ce3816ee
3 changed files with 76 additions and 17 deletions
  1. +57
    -2
      system/htmly.php
  2. +10
    -0
      system/includes/functions.php
  3. +9
    -15
      themes/blog/css/styles.css

+ 57
- 2
system/htmly.php View File

@ -1417,6 +1417,55 @@ get('/:static', function ($static) {
header("location: $login"); header("location: $login");
} }
die; die;
} elseif ($static === 'blog') {
if(config('blog.enable') !== 'true') return not_found();
if (!login()) {
file_cache($_SERVER['REQUEST_URI']);
}
$page = from($_GET, 'page');
$page = $page ? (int)$page : 1;
$perpage = config('posts.perpage');
$posts = get_posts(null, $page, $perpage);
$total = '';
$tl = blog_tagline();
if ($tl) {
$tagline = ' - ' . $tl;
} else {
$tagline = '';
}
if (empty($posts) || $page < 1) {
// a non-existing page
render('no-posts', array(
'title' => 'Blog - ' . blog_title(),
'description' => blog_title() . ' Blog Homepage',
'canonical' => site_url(),
'bodyclass' => 'noposts',
'is_front' => is_front(true),
));
die;
}
render('main', array(
'title' => 'Blog - ' . blog_title(),
'description' => blog_title() . ' Blog Homepage',
'canonical' => site_url() . 'blog',
'page' => $page,
'posts' => $posts,
'bodyclass' => 'inblog',
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; Blog',
'pagination' => has_pagination($total, $perpage, $page),
'is_blog' => is_blog(true),
));
} else { } else {
if (config("views.counter") != "true") { if (config("views.counter") != "true") {
@ -1873,6 +1922,12 @@ get('/:year/:month/:name', function ($year, $month, $name) {
else { else {
$var = 'blogPost'; $var = 'blogPost';
} }
if (config('blog.enable') === 'true') {
$blog = ' <span typeof="v:Breadcrumb"><a href="' . site_url() . 'blog">Blog</a></span> &#187; ';
} else {
$blog = '';
}
render('post', array( render('post', array(
'title' => $current->title . ' - ' . blog_title(), 'title' => $current->title . ' - ' . blog_title(),
@ -1881,7 +1936,7 @@ get('/:year/:month/:name', function ($year, $month, $name) {
'p' => $current, 'p' => $current,
'author' => $author, 'author' => $author,
'bodyclass' => 'inpost', 'bodyclass' => 'inpost',
'breadcrumb' => '<span typeof="v:Breadcrumb"><a property="v:title" rel="v:url" href="' . site_url() . '">' . config('breadcrumb.home') . '</a></span> &#187; ' . $current->tagb . ' &#187; ' . $current->title,
'breadcrumb' => '<span typeof="v:Breadcrumb"><a property="v:title" rel="v:url" href="' . site_url() . '">' . config('breadcrumb.home') . '</a></span> &#187; '. $blog . $current->tagb . ' &#187; ' . $current->title,
'prev' => has_prev($prev), 'prev' => has_prev($prev),
'next' => has_next($next), 'next' => has_next($next),
'type' => $var, 'type' => $var,
@ -2154,4 +2209,4 @@ get('.*', function () {
}); });
// Serve the blog // Serve the blog
dispatch();
dispatch();

+ 10
- 0
system/includes/functions.php View File

@ -1812,6 +1812,16 @@ function is_front($value = null)
} }
} }
// TRUE if the current page is the blog page.
function is_blog($value = null)
{
if (!empty($value)) {
return true;
} else {
return false;
}
}
// TRUE if the current page is tag index. // TRUE if the current page is tag index.
function is_tag($value = null) function is_tag($value = null)
{ {


+ 9
- 15
themes/blog/css/styles.css View File

@ -320,16 +320,13 @@ iframe {
/* ======= Sections======= */ /* ======= Sections======= */
.sections-wrapper { .sections-wrapper {
padding-top: 60px; padding-top: 60px;
padding-bottom: 60px;
padding-bottom: 30px;
} }
.section { .section {
margin-bottom: 30px; margin-bottom: 30px;
} }
.inpost.section, .inpage.section, .inprofile.section, .comment-wrapper.section, .tags.section, .section.last {
margin-bottom: 0px;
}
.comment-wrapper.section { .comment-wrapper.section {
margin-top:30px;
margin-bottom: 30px;
} }
.section .section-inner { .section .section-inner {
background: #fff; background: #fff;
@ -428,8 +425,11 @@ iframe {
margin-bottom: 20px; margin-bottom: 20px;
} }
.pager { .pager {
margin-top:30px;
margin-bottom: 0px;
margin-top:0px;
margin-bottom: 30px;
}
.inprofile .pager {
margin-bottom:0px;
} }
/* share section */ /* share section */
@ -581,8 +581,8 @@ ul.month {
float: none !important; float: none !important;
} }
.sections-wrapper { .sections-wrapper {
padding-bottom: 40px;
padding-top: 40px;
padding-top: 30px;
padding-bottom: 0px;
} }
.project-image { .project-image {
margin-bottom: 15px; margin-bottom: 15px;
@ -591,12 +591,6 @@ ul.month {
float:none!important; float:none!important;
text-align: center; text-align: center;
} }
.comment-wrapper.section {
margin-bottom:30px;
}
.pager {
margin-bottom: 30px;
}
} }
/* Small devices (tablets, 768px and up) */ /* Small devices (tablets, 768px and up) */
/* Medium devices (desktops, 992px and up) */ /* Medium devices (desktops, 992px and up) */


Loading…
Cancel
Save