Challenge: Load https://api.json-content-importer.com/extra/json/casinochompcasinocom/manifest_multicurrency.json and display those game-items containing a defined title.
Solution: Create a new JCI-template with the following settings.
- URL: see above
- twig-template:
Note
In older twig-Versions this was ok:
{% for g in games if g.title matches ‘/’~t~’/i’ %}
In twig 3 and above this is not ok. There you must separate for and if
{% set t = 'Mont' %} {% if urlparam.t %} {% set t = urlparam.t %} {% endif %} term: {{t}}<br> {% for g in games %} {% if g.title matches '/'~t~'/i' %} title: {{g.title}}<br> {% for i in g.images %} {{i.url}} {% endfor %} <hr> {% endif %} {% endfor %}
In Action:
term: Monttitle: Montezuma
/content/all/images/montezuma/banner.jpg /content/all/images/montezuma/tile.jpg