0
Twig에 다시 작성 기능이 작동하지 않습니다. 뭐가 잘못 되었 니?PHP 변수가 Twig로 다시 작성됩니다.
PHP 소스 :
<?php foreach ($datas as $data) { ?>
<?php if ($data['information_id'] == $info_id) { ?>
<a href="<?php echo $data['href']; ?>" class="list-group active"><?php echo $data['title']; ?></a>
<?php } else { ?>
<a href="<?php echo $data['href']; ?>" class="list-group"><?php echo $data['title']; ?></a>
<?php } ?>
<?php } ?>
재 작성 나뭇 가지에 :
{% for datas in data %}
{% if {{ attribute(data,information_id) }} == info_id %}
<a href="{{ data.href }}" class="list-group active">{{ data.title }}</a>
{% else %}
<a href="{{ data.href }}" class="list-group">{{ data.title }}</a>
{% endif %}
{% endfor %}
자세한 내용을 입력하십시오. 예를 들어 지금까지 무엇을 시도 했습니까? https://stackoverflow.com/help/how-to-ask – Cleared
'{{data.information_id}}'/'{{data [ 'information_id']}}'/'{{attribute (data, information_id)}}' – DarkBee