Converting CCv6 shortcode to PHP

Convert a CCv6 shortcode to PHP.

Overview

The issue arises when trying to translate a specific CCv6 array shortcode syntax into PHP code.
To access the data, use the get method with the correct key structure. For array data, you may need to loop through the results.

Answered
Connectivity v6
we webbusteruk 19 May, 2020
Quick question, how do we convert the following to PHP?

In CC: {var:php.[n].Model.field}

We tried $this->get('php.[n].Model.field') but obviously that didn't work.
teldrive teldrive 19 May, 2020
Not sure what you mean with php.[n]. but may be it helps if you use
$a=$this->data['model']['field'];

you can use it in php funtions inside CC
Max_admin Max_admin 20 May, 2020
Answer
1 Likes
$this->get("php") then loop on it with a foreach, because the [n] syntax will need using a special function
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
we webbusteruk 20 May, 2020
Thanks max!

@teldrive. If you do a read_data, you can obtain an array of all the values of a field by using that shortcode. Eg {var.read_data.[n].Model.field} will give you an array with {var.read_data.0.Model.field}, {var.read_data.1.Model.field}, {var.read_data.2.Model.field}, etc.

Useful to be re-used in another read_data. Eg we used read_data1 to obtain a list of userid (array) from database, then use that array as condition in another read_data.
Max_admin Max_admin 23 May, 2020
Actually $this->get("read_data.[n].Model.field") should work!!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.