0
Meine Neufassung zu Twig funktioniert nicht. Was ist falsch?PHP-Variable auf Twig umschreiben
PHP Quelle:
<?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 } ?>
Rewrite Zweig:
{% 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 %}
Bitte geben Sie weitere Einzelheiten an. Zum Beispiel, was hast du bisher versucht? Bitte lesen Sie https://stackoverflow.com/help/how-to-ask – Cleared
'{{data.information_id}}'/'{{data ['information_id']}}'/'{{Attribut (data, information_id)}} ' – DarkBee