Welcome Guest, Not a member yet? Register   Sign In
HTML Table Class proper use
#3

(This post was last modified: 04-21-2023, 11:09 PM by Corsari.)

Hi Luckmoshy
Thank you really much, today I'll try to dive in all the aspects you pointed out

And , also, I must tell you had read my mind, in fact I was wondering about if the HTML table class would have had sense in combination with CI cells 

Can you show a minimal example of how you implement it with a cell? Do you implement it with this feature https://codeigniter.com/user_guide/outgo...etup-logic ?

P.S. the second piece of code in the link is confusing me, because view_cell calls a method 'show' that is not clear to me where it comes from

PHP Code:
// app/Cells/RecentPosts.php
namespace App\Cells;

use 
CodeIgniter\View\Cells\Cell;

class 
RecentPosts extends Cell
{
    protected $posts;

    public function mount(?int $categoryId)
    {
        $this->posts model('PostModel')
            ->when($categoryId, function ($query$category) {
                return $query->where('category_id'$categoryId);
            })
            ->getRecent();
    }
}

// Called in main View:
<?= view_cell('RecentPosts::show', ['categoryId' => 5]); ?>




Thank you
Reply


Messages In This Thread
HTML Table Class proper use - by Corsari - 04-21-2023, 02:38 PM
RE: HTML Table Class proper use - by luckmoshy - 04-21-2023, 07:41 PM
RE: HTML Table Class proper use - by Corsari - 04-21-2023, 10:55 PM



Theme © iAndrew 2016 - Forum software by © MyBB