Created
April 8, 2012 21:37
-
-
Save jbroadway/2339929 to your computer and use it in GitHub Desktop.
Custom handler for displaying latest blog headlines with dates
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
; <?php /* | |
[myapp/headlines] | |
label = "My App: Latest 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
<?php | |
require_once ('apps/blog/lib/Filters.php'); | |
$posts = blog\Post::query (array ('id', 'ts', 'title')) | |
->where ('published', 'yes') | |
->order ('ts desc') | |
->fetch_orig (10); | |
echo $tpl->render ('myapp/headlines', 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
<ul> | |
{% foreach posts %} | |
<li> | |
{{ loop_value->ts|date ('M j', strtotime (%s)) }} | |
<a href="/blog/post/{{ loop_value->id }}/{{ loop_value->title|blog_filter_title }}">{{ loop_value->title }}</a> | |
</li> | |
{% end %} | |
</ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment