I have this controller:
class papersController extends Controller
{
//public $paper;
public function index($StudylevelId='',$SubjectId='',$PaperId='',$name='')
{
echo 'StudylevelId is'. $StudylevelId;
require MODEL.'paper_view.php';
//$Paper new PaperView($StudylevelId,$SubjectId,$PaperId);
// Retrieve data from the model
//$data = $this->model->getData();// Pass the data to the view
//$this->view->render('route_view', ['data' => $data]);
$this->view('papers\index',new PaperView($StudylevelId,$SubjectId,$PaperId));
$this->view->render();
}
i need to pass the three variables $StudylevelId,$SubjectId,$PaperId in index function() to the paperview model
// Handles paper details
class PaperView
{
// Public variables to be used in fsa template
public $mPaper;
public $mPaperId;
// Private stuff
private $_mStudylevelId;
private $_mSubjectId;
private $_mPaperId;
// Class constructor
public function __construct($StudylevelId,$SubjectId,$PaperId)
{
// Variable initialization
// Get StudylevelId from query string casting it to int $paginate = new Pag(35);
if ($StudylevelId<>'')
$this->_mStudylevelId = (int)$StudylevelId;
// Get SubjectId from query string casting it to int
if ($SubjectId<>'')
$this->_mSubjectId = (int)$SubjectId;
if ($PaperId<>'')//$_GET['ProductId']))
$this->mPaperId = (int)$PaperId;
//$_GET['ProductId'];
else
trigger_error('PaperId not set');
}
how can i access the data from paperview model in the actual view below.the echo statement works fine but the variables cannot be accessed in the view page for further use
<section class="bg" >
<?php //require MODEL.'paper_view.php';
/*$className = str_replace(' ', '',
ucfirst(str_replace('_', ' ',
substr(basename(__FILE__), 0, strrpos(basename(__FILE__), '.')))));*/
// Create presentation object
//$Papersdetail=new PaperView($StudylevelId,$SubjectId,$PaperId);
//$Papersdetail = new $className();
?>
<!-- Quiz Box -->
<div class="quiz">
<header>
<div class="title"><?=$data->mPaperId?><h2> PAPER 1</h2></div>
i can't acess $StudylevelId,$SubjectId,$PaperId in the above code. help out