08-05-2020, 04:36 AM
Hi, this is my Controller:
This is my view:
I have this error: Invalid argument supplied for foreach()
Thanks for help me!
PHP Code:
public function index()
{
$pager = \Config\Services::pager();
$articlesModel = new ArticlesModel();
$categoriesModel = new CategoriesModel();
$data = [
'title' => 'articoli',
'articles' => $articlesModel->orderBy('id', 'DESC')->findAll(),
'categories' => $categoriesModel->findAll(),
'pag' => $articlesModel->orderBy('id', 'DESC')->paginate(5),
'pager' => $articlesModel->pager,
];
echo view('articles/index', $data);
}
This is my view:
PHP Code:
<ul class="uk-pagination">
<?php foreach ($pager->links() as $link): ?>
<li><a href=""></a></li>
<?php endforeach; ?>
</ul>
I have this error: Invalid argument supplied for foreach()
Thanks for help me!
