Welcome Guest, Not a member yet? Register   Sign In
Invalid argument supplied for foreach() Pagination
#1

Hi, this is my Controller:
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!  Blush
Reply


Messages In This Thread
Invalid argument supplied for foreach() Pagination - by eleumas - 08-05-2020, 04:36 AM
RE: Pagination CodeIgniter 4 - by eleumas - 08-07-2020, 03:55 AM



Theme © iAndrew 2016 - Forum software by © MyBB