Welcome Guest, Not a member yet? Register   Sign In
C_I 4.1.8 View_cell parameter not working
#1

(This post was last modified: 02-07-2022, 07:21 AM by luckmoshy.)

What's up guys

I have this issue facing now on my project as follows :

I call up my view_cell somewhere;

PHP Code:
  <?= view_cell('\App\Libraries\Blog::recentPosts''slug=BlogModel, limit=5'?>

and this is a Libraries for
Code:
class blog
and
Code:
medhod recentPosts

PHP Code:
<?php namespace App\Libraries;

use 
Admin\Models\BlogModel;

class 
Blog{
public function 
recentPosts (string $slugint $limit)
{
  $model = new BlogModel();

    $posts $this->BlogModel->where('slug'$slug)
                            ->orderBy('title''desc')
                            ->limit($limit)
                            ->get();

    return view('\Admin\Views\Widgets\recentPosts', ['posts' => $posts]);
}


The last my widget to fetch data;
PHP Code:
</php Admin\Views\Widgets\recentPosts ?>


Then I get this exception
Why?

Undefined property: App\Libraries\Blog::$BlogModel search →

APPPATH\Libraries\Blog.php at line 10

Code:
APPPATH\Libraries\Blog.PHP at line 10

3 use Admin\Models\BlogModel;
4
5 class Blog{
6 public function recentPosts (string $slug, int $limit)
7 {
8    $model = new BlogModel();
9
10    $posts = $this->BlogModel->where('slug', $slug)
11                              ->orderBy('title', 'desc')
12                              ->limit($limit)
13                              ->get();
14
15    return view('\Admin\Views\Widgets\recentPosts', ['posts' => $posts]);
16 }
17 }
Codeigniter First, Codeigniter Then You!!
yekrinaDigitals

Reply




Theme © iAndrew 2016 - Forum software by © MyBB