Skip to content

Commit

Permalink
Some changes in helper functions
Browse files Browse the repository at this point in the history
Fixes #170
  • Loading branch information
navjottomer committed Dec 10, 2019
1 parent 157920c commit d7a9ea6
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions oc-includes/osclass/helpers/hPage.php
Expand Up @@ -225,7 +225,7 @@ function osc_get_static_page($internal_name, $locale = '')
$page = Page::newInstance()->findByInternalName($internal_name, $locale);
View::newInstance()->_exportVariableToView('page_meta', json_decode(@$page['s_meta'], true));

return View::newInstance()->_exportVariableToView('page', $page);
View::newInstance()->_exportVariableToView('page', $page);
}


Expand Down Expand Up @@ -255,8 +255,17 @@ function osc_has_static_pages()
if (!View::newInstance()->_exists('pages')) {
View::newInstance()->_exportVariableToView('pages', Page::newInstance()->listAll(false, 1));
}

if (View::newInstance()->_get('pageLoop') !== 'pages') {
View::newInstance()->_exportVariableToView('oldPage', View::newInstance()->_get('page'));
View::newInstance()->_exportVariableToView('pageLoop', 'pages');
}
$page = View::newInstance()->_next('pages');
if (!$page) {
View::newInstance()->_exportVariableToView('page', View::newInstance()->_get('oldPage'));
View::newInstance()->_exportVariableToView('pageLoop', '');
} else {
View::newInstance()->_exportVariableToView('page', View::newInstance()->_current('pages'));
}
View::newInstance()->_exportVariableToView('page_meta', json_decode($page['s_meta'], true));

return $page;
Expand All @@ -272,5 +281,11 @@ function osc_has_static_pages()
*/
function osc_reset_static_pages()
{
return View::newInstance()->_erase('pages');
if (View::newInstance()->_exists('oldPage')) {
View::newInstance()->_exportVariableToView('page', View::newInstance()->_get('oldPage'));
}
if (View::newInstance()->_exists('pagLoop')) {
View::newInstance()->_exportVariableToView('pageLoop', '');
}
return View::newInstance()->_reset('pages');
}

1 comment on commit d7a9ea6

@navjottomer
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor change
c87e42b

Please sign in to comment.