diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php index 8b905c881..fa914ef87 100755 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -32,7 +32,16 @@ class FreshRSS_index_Controller extends Minz_ActionController { Minz_Error::error(404); } - $this->view->callbackBeforeContent = function ($view) { + $this->view->categories = FreshRSS_Context::$categories; + + $this->view->rss_title = FreshRSS_Context::$name . ' | ' . Minz_View::title(); + $title = FreshRSS_Context::$name; + if (FreshRSS_Context::$get_unread > 0) { + $title = '(' . FreshRSS_Context::$get_unread . ') ' . $title; + } + Minz_View::prependTitle($title . ' · '); + + $this->view->callbackBeforeFeeds = function ($view) { try { $tagDAO = FreshRSS_Factory::createTagDao(); $view->tags = $tagDAO->listTags(true); @@ -40,7 +49,13 @@ class FreshRSS_index_Controller extends Minz_ActionController { foreach ($view->tags as $tag) { $view->nbUnreadTags += $tag->nbUnread(); } + } catch (Exception $e) { + Minz_Log::notice($e->getMessage()); + } + }; + $this->view->callbackBeforeEntries = function ($view) { + try { FreshRSS_Context::$number++; //+1 for pagination $entries = FreshRSS_index_Controller::listEntriesByContext(); FreshRSS_Context::$number--; @@ -67,15 +82,6 @@ class FreshRSS_index_Controller extends Minz_ActionController { Minz_Log::notice($e->getMessage()); Minz_Error::error(404); } - - $view->categories = FreshRSS_Context::$categories; - - $view->rss_title = FreshRSS_Context::$name . ' | ' . Minz_View::title(); - $title = FreshRSS_Context::$name; - if (FreshRSS_Context::$get_unread > 0) { - $title = '(' . FreshRSS_Context::$get_unread . ') ' . $title; - } - Minz_View::prependTitle($title . ' · '); }; } diff --git a/app/layout/layout.phtml b/app/layout/layout.phtml index b244639a4..2e16672e6 100644 --- a/app/layout/layout.phtml +++ b/app/layout/layout.phtml @@ -18,13 +18,7 @@ allow_referrer) { ?> -callbackBeforeContent)) { - call_user_func($this->callbackBeforeContent, $this); - } -?> + -partial('header'); ?> +partial('header'); +?>
- render(); ?> + callbackBeforeFeeds)) { + call_user_func($this->callbackBeforeFeeds, $this); + } + $this->render(); + ?>
partial('nav_menu'); + flush(); + if (isset($this->callbackBeforeEntries)) { + call_user_func($this->callbackBeforeEntries, $this); + } + $class = ''; if (FreshRSS_Context::$user_conf->hide_read_feeds && FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_NOT_READ) && diff --git a/app/views/index/normal.phtml b/app/views/index/normal.phtml index ac2ea812d..d5ae8e2f9 100644 --- a/app/views/index/normal.phtml +++ b/app/views/index/normal.phtml @@ -3,6 +3,11 @@ $this->partial('aside_feed'); $this->partial('nav_menu'); +flush(); +if (isset($this->callbackBeforeEntries)) { + call_user_func($this->callbackBeforeEntries, $this); +} + if (!empty($this->entries)) { $display_today = true; $display_yesterday = true; diff --git a/app/views/index/reader.phtml b/app/views/index/reader.phtml index a92767f1c..c15b936ee 100644 --- a/app/views/index/reader.phtml +++ b/app/views/index/reader.phtml @@ -1,6 +1,11 @@ partial('nav_menu'); +flush(); +if (isset($this->callbackBeforeEntries)) { + call_user_func($this->callbackBeforeEntries, $this); +} + if (!empty($this->entries)) { $lazyload = FreshRSS_Context::$user_conf->lazyload; $content_width = FreshRSS_Context::$user_conf->content_width;