Free: show the data {…}
Syntax for showing JCI data
The free JCI Parser uses curly brackets {
and }
to identify placeholders with 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 datafield 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 differs from the JSON-data.
{start:purejsondata}
Default display of a datafield is NOT HTML: & <
etc. are converted to & <
. 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-urlencoded value of the datafield start
. Necessary for building URLs.
{start:urlencode}
If datafield start
is not empty, add “extratext” to the right (or left) of the datafield’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 datafield street
is not empty, add “extratext_left” to the left and “extratext_right” to the right of the datafield’s value. Permitted characters are limited to:
a-zA-Z0-9,;_-:<>/
{start:ifNotEmptyAddLeftRight:extratext_left##extratext_right}
you can combine purejsondata
or html
and
… like this (example see here)ifNotEmptyAddLeftRight
{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 dateformat or an unixtimestam (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) timezoneoffset 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 like ...., "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 to a number without “,” this defines the number of items displeyed 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.