Closed maxell623062 closed 1 year ago
good evening dev, I have the fix for this problem, well I'm sending it anyway I haven't tested on nodCms 3.4.1, the mifs are from 3.1.5,
PAGINATION
see http://byoosdigital.com/cms/public/fr IN /root/nodcms-layout/Views/common/pagination/ copy the pagination_bootstrap.php file as seen on the site https://includebeer.com/fr/blog/creation-dune-application-web-de-base-avec-codeigniter-4-partie-4
IN root/nodcms-core/Config/pager.php add the line // Custom template to use Bootstrap bootstrap' => '\NodCMS\LayoutViewscommon\pagination_bootstrap',
IN IN root/nodcms-core/Controllers/GeneralAdmin.php //for pagination user public function user(int $page = 1) { ... $config = array(); $config['base_url'] = ADMIN_URL.'user'; $tab = array_filter(explode('/', $config['base_url'])); unset($tab[0], $tab[2]); $config['tab_uri_segment'] = implode('/', $tab); $config['reuse_query_string'] = TRUE; $config['total_rows'] = Services::model()->users()->getCount(); $config['uri_segment'] = count($tab)+1; $config['per_page'] = 10; ...
IN root/nodcms-core/Controllers/App.php
protected function mkPagination(array $config)
{
$pagination = \ConfigServices::pager();
$pagination->setPath($config['tab_uri_segment']);
$pagination->setSegment($config['uri_segment']);
if((int) ceil($config['total_rows'] / $config['per_page']) > 1){
$this->data['pagination'] = $pagination->makeLinks($pagination->getCurrentPage(), $config['per_page'], $config['total_rows'], 'bootstrap', $config['uri_segment']);
}
else{
$this->data['pagination'] = "";
}
}
IN root/nodcms-blog/Controllers/blog.php //for pagination blog - posts function posts($page = 1, $category_id = null) { //custom byoosdigital.com $tab = array_filter(explode('/', $self_url)); unset($tab[0], $tab[2]); $config['tab_uri_segment'] = implode('/', $tab); $config = array( 'base_url'=>$self_url, 'query_string_segment'=>'', 'reuse_query_string'=>TRUE, 'total_rows'=>Models::blogPost()->getCount($conditions), 'uri_segment'=>count($tab)+1, 'tab_uri_segment'=>implode('/', $tab), 'per_page'=>10, );
END PAGINATION
see http://byoosdigital.com/cms/public/fr on version 3.3c P.S OK test for pagination blog - post success on this day 2023/01/12
That worked a treat, thanks for you help.
If you have say 20 blogs when you view them only the first 10 are displayed. You no longer get the option to move to page 2, 3 etc to view the remaining blog posts as you did in the older version of Nodcms.
I know it's not my site as I did a fresh install, creating 15 dummy blog posts and had the same issue. Any ideas.