transmit variables

admin_wiky 23 Oct, 2014
Hi all,

I am using Table Display type in my CC.
I have variable in header code (frontlist -> list display -> table) and I need to transmit (use) this variable in php functions (frontlist -> settings). I used global operaror, but it doesnt work.
interesting is that variable used in php functions as global is visible in header code, but in reverse direction isnt visible.

any idea?
thx
Max_admin 03 Nov, 2014
Hi homeopat,

How do you call/set the variable ? you may try to store it in the session, or store it in the $_POST array.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
admin_wiky 04 Nov, 2014
Hi Max,

I used global variable, but it doesnt work in this direction (from header to body - table display type)
Then I have tried $_POST, $_GET and $_SESSION and this works particulary. I mean that I have to click on submit button twice to get correct value.
I dont know why it works that way
Max_admin 04 Nov, 2014
Sorry, but which submit button ?

And why do you need to pass a variable from header to row ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
admin_wiky 05 Nov, 2014
submit button for filtering part of data where I use variable wich I need calculated to the end (from all records - not filtered only).
So I have a query in header box and I need to transmit this variable to body for calculate to the end.

thx
Max_admin 14 Nov, 2014
Hi homeopat,

Sorry for the late reply!

What about doing your calculation and using the variable all in one place ? the $rows variable is available in the header and footer, so you can simply do a foreach loop and calculate the result you need.

Let me know!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
admin_wiky 14 Nov, 2014
I will describe what I need.
I have table with dates and values and I have filter by months. I calculate the saldo value by code (not saved in db).
So If I need show data in definite season (i.e. march) I have to calculate the saldo value from the begining (this is done in header) and then I need to transmit this value to body for showing exact saldo of that month.
one way is in $_session ($_GET and $_POST dont work). But I have to click twice od submit button (filer) to get correct value in saldo column.
do you understand me?

thx.
Max_admin 14 Nov, 2014
Ok, please try this:

Create a new Chronoform, add a "Connection action" to the "on load", set the action to "index" and set the connection's name, add a "custom code" action before it and do your calculation then set that inside global variable or $_POST then use it in the rows.

Does this work ?

regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
admin_wiky 14 Nov, 2014
I understand you, but I forgot said you one thing.
In custom code I use $row variables from CC for setting query in where statement.

resume>
My CC is named "newpokladnikniha"
I have created a CF named "pokladnikniha-saldo"
I put to on load section Custom code with hello echo and then put Connection Action with name "newpokladnikniha" and action "index".
If I put to the CF in custom code echo "hello" then doesnt show in CC.

thx
admin_wiky 14 Nov, 2014
custom code
<?php
echo "holaho";
?>
Max_admin 14 Nov, 2014
But then how do you access the action ? you should access it using the form link, did you try that ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
admin_wiky 14 Nov, 2014
No, I didnt.
so I put to the FrontList --> actions - view - form event : pokladnikniha-saldo:load

but nothing happened, no holaho text.
Max_admin 14 Nov, 2014
No, frontlist > actions > index > form event

Then try to test it using the connection's main page or the form link too.
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
admin_wiky 20 Nov, 2014
Hi max,

it doesnt work. nothing depict if I have simple echo "holaho" in custom code.
I tried in CC put this code to frontlist > actions > index > code
<?php
echo "holaho";
?>

but same result, nothing depict.
Max_admin 29 Nov, 2014
Hi homeopat,

Apologies for the late reply!

I checked the code and found that in the table block, the body is processed before the header, but its output is only sent after the header output is sent.

So, you can either build your list using the "custom" block, or send me a message using the "contact us" page to get a patch file and test it.

Regards,
Max
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.