Twig-template engine (PRO plugin)

The free Version of the JSON Content Importer-Plugin is based on the proprietary “JCI-parser” with some great features. This is good and still available.

But: If you want to have full control of your JSON, build applications etc. you need a better parser. For this the pro-plugin comes with the popular Twig-engine (https://twig.symfony.com/doc/1.x/templates.html).


The usage is as following:
After getting access to the JSON-data the PRO plugin can suggest you twig-code for displaying all the JSON-data.
For that create a template with the URL and maybe needed accessdata so that JSON is available. Leave the template empty and switch on the debugmode.
Preview the page and see the twig-code generated.


How to use Twig:
You can use Twig-code just the way as with jci-template-code in the free plugin (ok, but not recommended: use the PRO plugin-template, see below)
Example-Shortcode:

[jsoncontentimporterpro url=http://... parser=twig]
{% for eventitem in event %}
{% if eventitem.evs3|length > 0 %}
{{eventitem.eventname}}
{% endif %}
{% endfor %}
[/jsoncontentimporterpro]

The better way is to use Twig via the PRO plugin-templates:.


In short: Twig code is in the PRO plugin-template with Number NO. Then the Shortcode is as simple like this:

[jsoncontentimporterpro id=NO]

Twig-syntax:

Sometimes the devil is in the detail:


Twig has many powerful commands, but sometimes more is needed. Therefore in the PRO plugin several additional Twig-extensions are added: