Print

Free: show the data {…}

The syntax for showing JCI data

The free JCI Parser uses curly brackets { and } to identify placeholders that should be replaced by JSON data. In the basic example with the API from WordPress.org we used basenode=level1 together with the template:

TEMPLATE: {start}

The free JCI Parser has some syntax to modify the output

The default display of a data field is not HTML, but HTML tags are converted. This allows you to display the pure data from the JSON feed. Ty, this is the output that differs from the JSON data.

{start:purejsondata}

The default display of a data field is NOT HTML: & < etc. are converted to &amp; &lt;. This will display the HTML code as code. To output the HTML add “:html”.

{start:html}

Same as {street:html} plus \n linefeeds are converted linefeeds to HTML linebreaks:

{start:htmlAndLinefeed2htmlLinefeed}

Insert the PHP-URL-encoded value of the data field start. Necessary for building URLs.

{start:urlencode}

If the data field start is not empty, add “extratext” to the right (or left) of the data field’s value. Permitted characters are limited to:
a-zA-Z0-9,;_-:<>/

{start:ifNotEmptyAddRight:extratext}
{start:ifNotEmptyAddLeft:extratext}

you can combine html and ifNotEmptyAdd… like this

{start:html,ifNotEmptyAddRight:extratext}
{start:html,ifNotEmptyAddLeft:extratext}

same as ifNotEmptyAddRight:

{start:ifNotEmptyAdd:extratext}

If the data field street is not empty, add “extratext_left” to the left and “extratext_right” to the right of the data field’s value. Permitted characters are limited to:
a-zA-Z0-9,;_-:<>/

{start:ifNotEmptyAddLeftRight:extratext_left##extratext_right##}

you can combine purejsondata or html and ifNotEmptyAddLeftRight… like this (example see here)

{start:html,ifNotEmptyAddLeftRight:extratext_left##extratext_right##}

or

{start:purejsondata,ifNotEmptyAddLeftRight:extratext_left##extratext_right##}

datetime

you can format time and date if JSON gives a valid date format or a UNIX timestamp (for example, see here)

{JSONFIELD:datetime,DATE_TIME_FORMAT,TIMEZONE_IN_SECONDS}
  • JSONFIELD: name of the JSON field with the date or time data
  • DATE_TIME_FORMAT: e. g. “m-d-Y H:i” see https://www.php.net/manual/en/datetime.format.php for syntax
  • TIMEZONE_IN_SECONDS: Number which is the (maybe needed) timezone offset in seconds (e.g., one day=24 hours = 86400 seconds)

Show a list of JSON-items

Attention: This does not work with any JSON!
When you have a JSON-Node with a list of items, ...., "mylist": ["one", "two", "three", "four"],... you can display it with that syntax:

...
{subloop-array:mylist:no_first_item,no_last_item}AA{JCILISTITEM}BB<<br>
{/subloop-array:mylist}
...

no_first_item stands for the number of the first to be displayed item. no_last_item for the last one. So “2,3” would show “on” and “three”.
If you set “no_first_item,no_last_item” to -1, all items are shown. If a number is without “,” this defines the number of items displayed from the start.

JCILISTITEM is the keyword to tell the JCI-Plugin that a list of items should be handled.
See here for an example.

Was this article helpful?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.
On this page: