Forums

Accessing data / variables

anne1979 25 Apr, 2016
Hello there,

I am trying to access the row data variable for using in php (number_format...)

<?php
$fPrice = number_format($this->data['Fahrzeug']['price'], 2, ",", ".");
?>

In some examples I have seen the usage of
$form->data['ModelID]['fieldname']
.
When I am in the list view, it works, when I use
$this->data['ModelID]['fieldname']
.

But when I am in the Front list > List display > Body code none of these work!

How can I access the row data from within php in the code box?

Please give me a hint,
Anne
anne1979 25 Apr, 2016
Hi,
uups: with "list view" above I mean Front list > Actions > View
anne1979 01 May, 2016
Answer
1 Likes
Well, I found a solution / workaround for this by using the PHP Box with the line
Fahrzeug.price:return number_format($row['Fahrzeug']['price'], 2, ",", ".");

in combination with the normal field output in the Front List > List display > Custom > Body Code Box...

Again, the used field (Fahrzeug.price) has to be added to the Columns List Box above as well to be processed.

Have a nice evening y'all,
Anne
This topic is locked and no more replies can be posted.