Forums

Converting CCv6 shortcode to PHP

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 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 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...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
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 23 May, 2020
Actually $this->get("read_data.[n].Model.field") should work!!
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
This topic is locked and no more replies can be posted.