Closed
Description
I created a account on forums, but i donnt know why cannt post thread. i have a problem:
Layout file:
<!DOCTYPE html>
<html lang="en">
<head>
<title>test-{title}</title>
<style>
{styles}
</style>
</head>
<body>
<div class="container-fluid">
{body}
</div>
<script>
{footscript}
</script>
</body>
</html>
View code:
<div class="wrap">
<ul>
<?php foreach ($append as $item): ?>
<li><?=$item['id'] .'='.$item['name'] ?></li>
<?php endforeach;?>
</ul>
</div>
Controller code:
$append = ['append' => [
['id' => 1, 'name' => 'fsa' ],
['id' => 2, 'name' => 'fasdf2' ],
['id' => 3, 'name' => 'fsda3' ]
]];
$bodyview = view('welcome', $append);
$tpldata = [
'title'=> 'page title',
'styles' =>'.div{ font-size:1.1em; }',
'footscript' =>'//var b = 1;',
'envir' => ENVIRONMENT
];
$parser = \Config\Services::parser();
echo $parser->setData($tpldata)
-> setVar('body', $bodyview, 'raw')
-> render('layout/default');
But... page body is:
what should I do? thank you very much.
Metadata
Metadata
Assignees
Labels
No labels
Activity