Welcome Guest, Not a member yet? Register   Sign In
Using view_cell - I am not clearly getting how to do it
#7

(This post was last modified: 08-31-2023, 03:31 AM by ozornick.)

All right.

PHP Code:
<?php

namespace App\Cells;

class 
BlockCell
{
    public function getBlock($bloc_name)
    {
        $blockFromModel = $this->asArray()
             ->where(['bloc_name' => $bloc_name])
             ->first();

         return view('Block/block', ['block' => $blockFromModel]);
    }
}

// file app/Views/Block/block.php with HTML
<h2><?= $block['title'?></h2>
<div><?= $block['content'?></div> 
Simple CI 4 project for beginners codeigniter-expenses ( topic )
Reply


Messages In This Thread
RE: Using view_cell - I am not clearly getting how to do it - by ozornick - 08-31-2023, 03:30 AM



Theme © iAndrew 2016 - Forum software by © MyBB