From b1f8cda044908278dde1e99a647c3394aeb31d0b Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Sat, 17 Dec 2022 11:39:44 +0100 Subject: [PATCH] fix dblayer error --- _public.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/_public.php b/_public.php index 3d0f077..23f53fe 100644 --- a/_public.php +++ b/_public.php @@ -94,14 +94,20 @@ class pubSaba $params['limit'] = [(($_page_number - 1) * $params['limit']), $params['limit']]; # get posts + $posts = dcCore::app()->blog->getPosts($params); + if ($posts->isEmpty()) { // hack: don't breack context + $params = ['limit' => $params['limit']]; + $posts = dcCore::app()->blog->getPosts($params); + } dcCore::app()->ctx->post_params = $params; - dcCore::app()->ctx->posts = dcCore::app()->blog->getPosts($params); + dcCore::app()->ctx->posts = $posts; + unset($params); } dcCore::app()->ctx->saba_options = $options; } - public static function getPostsParams($params) + public static function getPostsParams(&$params) { if (!isset($params['sql'])) { $params['sql'] = '';