Вот моя проблема
Index.php
$rain->assign("name_list", $name_list );
$html = $rain->draw( 'hero', $return_string = true ); echo $html;
$ NAME_LIST
Array
(
[0] => stdClass Object
(
[nom_fr] => Femme
)
[1] => stdClass Object
(
[nom_fr] => Men
)
[2] => stdClass Object
(
[nom_fr] => VETEMENTS
)
)
hero.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>{$title}</title>
<meta name="description" content="">
<meta name="author" content="">
</head>
<body>
{loop="name_list"}
{$value.name}</br>
{/loop}
</body>
Parse error: syntax error, unexpected ')', expecting :: (T_PAAMAYIM_NEKUDOTAYIM) in C:\xampp\htdocs\SimpleMVCframework\vendor\rain\raintpl\cache\hero.5e12305790f6fdc3ad476dddffd4644f.rtpl.php on line **10**
<?php if(!class_exists('Rain\Tpl')){exit;}?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title><?php echo htmlspecialchars( $title, ENT_COMPAT, 'UTF-8', FALSE ); ?></title>
<meta name="description" content="">
<meta name="author" content="">
</head>
<body>
10 <?php $counter1=-1; if( isset(name_list) && ( is_array(name_list) || name_list instanceof Traversable ) && sizeof(name_list) ) foreach( name_list as $key1 => $value1 ){ $counter1++; ?>
<?php echo htmlspecialchars( $value1["name"], ENT_COMPAT, 'UTF-8', FALSE ); ?></br>
<?php } ?>
</body>
</html>
Где моя проблема?
Добавьте $ в имя переменной внутри тега цикла:
{loop="$name_list"}
Других решений пока нет …