Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added thumbnail sidebar embed to blog app
- Loading branch information
Showing
3 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
/** | ||
* Displays the latest blog posts with feature thumbnails for the | ||
* top three. | ||
*/ | ||
|
||
require_once ('apps/blog/lib/Filters.php'); | ||
|
||
$limit = 8; | ||
|
||
$posts = blog\Post::query (array ('id', 'ts', 'title', 'thumbnail')) | ||
->where ('published', 'yes') | ||
->order ('ts desc') | ||
->fetch_orig ($limit); | ||
|
||
$page->add_script ('/apps/blog/css/related.css'); | ||
|
||
echo $tpl->render ('blog/thumbnail-sidebar', array ( | ||
'posts' => $posts | ||
)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{! admin/util/dates !} | ||
|
||
{% foreach posts as n, post %} | ||
{% if n < 3 %} | ||
<div class="blog-related-post item"> | ||
<div class="thumbnail-wrapper"> | ||
<a href="/blog/post/{{post->id}}/{{post->title|URLify::filter}}"> | ||
<div class="thumbnail" | ||
{% if post->thumbnail != '' %} | ||
style="background-image: url('/{{post->thumbnail|Image::resize (%s, 400, 300, 'cover', 'ext')}}')" | ||
{% end %} | ||
></div> | ||
</a> | ||
</div> | ||
<div class="item-info"> | ||
<h4><a href="/blog/post/{{post->id}}/{{post->title|URLify::filter}}">{{post->title}}</a></h4> | ||
<p>{{post->ts|I18n::short_date_year}}</p> | ||
</div> | ||
</div> | ||
{% end %} | ||
{% end %} | ||
|
||
<ul class="blog-headlines"> | ||
{% foreach posts as n, post %} | ||
{% if n >= 3 %} | ||
<li>{{ post->ts|I18n::short_date }} <a href="/blog/post/{{ post->id }}/{{ post->title|URLify::filter }}">{{ post->title }}</a></li> | ||
{% end %} | ||
{% end %} | ||
</ul> |