Welcome Guest, Not a member yet? Register   Sign In
How to use method function modal data to view codeigniter 4.5.3
#2

(This post was last modified: 08-29-2024, 01:02 PM by captain-sensible.)

lets clarify the question ... are you saying you dont quite get how to get data from a model class , which has been instantiated in a controller and that data is passed in the controller along the lines of .
Code:
Model class is say called BlogModel.php

in controller  there is a property called $handle;

$this->handle  = new BlogModel();
$result = this->handle->getArticle($slug);
//getArticle  is a method in BlogModel.php
// a variable $slug  is passed as a paramer into the model method
$data=[ 'title'=> 'something',
'results'=>$result];

echo view ('someview',$data);
in the view you can use
<?php foreach ($results as $stuff)
{
echo "<h11>".  $stuff ['tableFieldName'] ."   then next field ".$stuff['tableFieldName2']. "</h11>";


}
?>
if thats not what your after please elaborate
CMS CI4 A CMS system, runs out of the box written on top of CI4
Arch Book  CodeIgniter4 on Apache(pages 92-114) 
Reply


Messages In This Thread
RE: How to use method function modal data to view codeigniter 4.5.3 - by captain-sensible - 08-29-2024, 12:57 PM



Theme © iAndrew 2016 - Forum software by © MyBB