Hello,
I want to do some calculations in the ACTION from the Front List.
I saw on the forum:
<?php
pr($this->data);
etcetera....
If I use this the whole Arra is displayed correct.
But I want to use some fields.
I have tried to get the value of a field by using this statement: $int1 = $this->data['Veiligheid'];
Unfortunately the result is an empty field.
What am I doing wrong?
Please Help.
I want to do some calculations in the ACTION from the Front List.
I saw on the forum:
<?php
pr($this->data);
etcetera....
If I use this the whole Arra is displayed correct.
But I want to use some fields.
I have tried to get the value of a field by using this statement: $int1 = $this->data['Veiligheid'];
Unfortunately the result is an empty field.
What am I doing wrong?
Please Help.
Hi JohnVosDev,
Using the pr() code will just dump the data - this is useful to see what is in the data object and what it is called. (it may help to click 'View page source' in your browser to see a better formatted version).
In my tests $this->data doesn't exist - I just get an error message.
If you need to know what is there then this code will show you the data in the current listing:
I hope this helps a bit.
Bob
Using the pr() code will just dump the data - this is useful to see what is in the data object and what it is called. (it may help to click 'View page source' in your browser to see a better formatted version).
In my tests $this->data doesn't exist - I just get an error message.
If you need to know what is there then this code will show you the data in the current listing:
<?php
echo'<div>$this->view->vars[rows]: '.print_r($this->view->vars['rows'], true).'</div>';
?>
and the result looks like this (this is a very simple listing just showing the title from the contents table:Array
(
[0] => Array
(
[content] => Array
(
[title] => Getting Started
)
)
[1] => Array
(
[content] => Array
(
[title] => My first article
)
)
[2] => Array
(
[content] => Array
(
[title] => Test article
)
)
So the title of the first row would be in $this->view->vars['rows'][0]['content']['title']
I hope this helps a bit.
Bob
Dear Bob,
In my case.
If I code:
echo'<div>$this->view->vars[rows]: '.print_r($this->view->vars['rows'], true).'</div>';
the result is only the text $this->view->vars[rows]:
and no content.
If I code:
pr($this->data);
the result is the dump as giving next.
My question is how can I use the content of the field VEILIGHEID.
In my case the value 10.
In my case.
If I code:
echo'<div>$this->view->vars[rows]: '.print_r($this->view->vars['rows'], true).'</div>';
the result is only the text $this->view->vars[rows]:
and no content.
If I code:
pr($this->data);
the result is the dump as giving next.
My question is how can I use the content of the field VEILIGHEID.
In my case the value 10.
Array
(
[M1] => Array
(
[Beoordeling_id] => 8
[created] => 2015-02-05 10:09:07
[modified] =>
[Beoordelaar] => johnvos
[IdeeNummer] => 1
[Veiligheid] => 10
[Duurzaamheid] => 10
[Ecologie] => 10
[LifecycleKosten] => 10
[Bruikbaarheid] => 10
[Toekomstgerichtheid] => 10
[ToelichtingPark] =>
[Inpassing] => 9
[Service] => 9
[DuurEffect] => 9
[StijlVormgeving] => 9
[ToelichtingVerfraaiing] =>
[DraagvlakDoelgroep] => 10
[Initiatieven] => 10
[Doelgroepen] => 10
[ToelichtingDraagvlak] =>
)
[cont] => lists
[ccname] => ToonBeoordeling
[act] => view
[gcb] => 8
)
I have found the solution.
I have to use:
$int1 = $this->data['M1']['Veiligheid'];
Thanks for the TIP
I have to use:
$int1 = $this->data['M1']['Veiligheid'];
Thanks for the TIP
Hi JohnVosDev,
Well done - I see I was testing using the Header box and not the Actions box :-(
From your output $this->data['M1']['Veiligheid'] should have the value you want.
Bob
Well done - I see I was testing using the Header box and not the Actions box :-(
From your output $this->data['M1']['Veiligheid'] should have the value you want.
Bob
Bob,
Is there a short-hand notation similar to {Model.field} that I have seen in ChronoForms that can be used in the Header box instead of inserting PHP code in the HTML?
Jim
Is there a short-hand notation similar to {Model.field} that I have seen in ChronoForms that can be used in the Header box instead of inserting PHP code in the HTML?
Jim
This topic is locked and no more replies can be posted.