fix dblayer error

This commit is contained in:
Jean-Christian Paul Denis 2022-12-17 11:39:44 +01:00
parent 8a3745b116
commit b1f8cda044
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951

View File

@ -94,14 +94,20 @@ class pubSaba
$params['limit'] = [(($_page_number - 1) * $params['limit']), $params['limit']]; $params['limit'] = [(($_page_number - 1) * $params['limit']), $params['limit']];
# get posts # 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->post_params = $params;
dcCore::app()->ctx->posts = dcCore::app()->blog->getPosts($params); dcCore::app()->ctx->posts = $posts;
unset($params); unset($params);
} }
dcCore::app()->ctx->saba_options = $options; dcCore::app()->ctx->saba_options = $options;
} }
public static function getPostsParams($params) public static function getPostsParams(&$params)
{ {
if (!isset($params['sql'])) { if (!isset($params['sql'])) {
$params['sql'] = ''; $params['sql'] = '';