Permalink
Browse files

show posts on homepage

  • Loading branch information...
chemix committed Jun 13, 2014
1 parent 7e7ad14 commit 7fed0d0a70ac7472a1b70d696f18fae4e2993e52
Showing with 28 additions and 1 deletion.
  1. +7 −0 app/presenters/HomepagePresenter.php
  2. +21 −1 app/templates/Homepage/default.latte
@@ -12,8 +12,15 @@
class HomepagePresenter extends BasePresenter
{
/**
* @var \Nette\Database\Context @inject
*/
public $database;
public function renderDefault()
{
$facebookWallPosts = $this->database->table('facebook_wallposts')->where('status','1')->limit(5)->fetchAll();
$this->template->wallPosts = $facebookWallPosts;
}
}
@@ -1,3 +1,23 @@
{block content}
<h1>Facebook wall</h1>
<a n:href="Import:default">Import</a>
<a n:href="Import:default">Import</a>
<div n:if="$wallPosts" class="facebook-posts">
<div n:foreach="$wallPosts as $post" class="post {$post->type}">
<h3 n:if="$post->name">{$post->name}</h3>
<img n:if="$post->picture" src="{$post->picture}" />
{if $post->message}
<p>
{$post->message|truncate:250:'...'}
<a n:if="$post->link" href="{$post->link}">více</a>
</p>
{else}
{if $post->link}
<a href="{$post->link}">více</a>
{else}
<a href="http://www.facebook.com/nettefw">více</a>
{/if}
{/if}
</div>
</div>

0 comments on commit 7fed0d0

Please sign in to comment.