diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 57e8b7b..a8f6415 100644 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -259,13 +259,17 @@ class Poche break; default: # home, favorites and archive views $entries = $this->store->getEntriesByView($view, $this->user->getId()); - $this->pagination->set_total(count($entries)); - $page_links = $this->pagination->page_links('?view=' . $view . '&sort=' . $_SESSION['sort'] . '&'); - $datas = $this->store->getEntriesByView($view, $this->user->getId(), $this->pagination->get_limit()); $tpl_vars = array( - 'entries' => $datas, - 'page_links' => $page_links, + 'entries' => '', + 'page_links' => '', ); + if (count($entries) > 0) { + $this->pagination->set_total(count($entries)); + $page_links = $this->pagination->page_links('?view=' . $view . '&sort=' . $_SESSION['sort'] . '&'); + $datas = $this->store->getEntriesByView($view, $this->user->getId(), $this->pagination->get_limit()); + $tpl_vars['entries'] = $datas; + $tpl_vars['page_links'] = $page_links; + } Tools::logm('display ' . $view . ' view'); break; } diff --git a/tpl/home.twig b/tpl/home.twig index 6b80c6e..f51c34f 100644 --- a/tpl/home.twig +++ b/tpl/home.twig @@ -19,7 +19,10 @@ {% endblock %} {% block content %} {{ page_links | raw }} - {% for entry in entries %} + {% if entries is empty %} +

{% trans "No link available here!" %}

+ {% else %} + {% for entry in entries %}

{{ entry.title|raw }}

- {% endfor %} + {% endfor %} + {% endif %} {{ page_links | raw }} {% endblock %} \ No newline at end of file