Hello everyone. I am developing in CI 4. I changed the appserv version recently.
I saved my project from the old www folder and copied it into the new www in my new installation. but when I send variables to the view it doesn't recognize them.
PHP Code:
$result->adverts = $adverts; //ad list
$dat['result'] = $result;
$view = \ Config\Services::renderer();
$view->setData($dat);
$data['previews'] = $view->render('tools/previews');
In my view :
APPPATH/Views\tools\previews.php
Code:
<?
print_r($result); //line 2
print_r($result->adverts);//line 3
foreach($result->adverts as $advert){
$time = Time::parse($advert->date);
?>
<div class=" preview col-lg-2 col-md-2 col-sm-3 col-xs-12">
<div class="box">
<a href="<?=$advert->getHref(NULL, $m_category)?>"> //line 9
the error that return is "
ErrorException, Undefined variable: advert" in
APPPATH/Views\tools\previews.php at line
9
the lines 2 and 3 don't print anything.
why if lines two an three does not print anything code is executed inside the foreach
I have not changed anything within my project. I suppose the problem is related to some php or apache configuration.
php 7.3.10
Thanks in advance.