CalcBuilder Forum

Variable passing to PDF, email and Excel

User ritchg 2011-12-22 18:38:32

I am trying to include some text with some ROI calculators to explain to the user how the calculationis done. As I cannot include text in the Calc Builder itself, I've added some PHP to the pdf creation module but I'd like to have different calculators use different explanatory text. Can I pass a variable from the calculation entry area to the pdf, Excel and email creation modules?
Thanx.

Moonsoft support 2011-12-22 19:57:50

Hello,

One quick solution maybe including in 'code' of each calculator a variable stored at user session. Then in PDF, email and csv you can get it from session again.

Hope this helps,

Moonsoft Team

User ritchg 2011-12-23 13:39:50

Okay - so if I include (for example)
$CommentCode = 'MAIN';
in the same place as my calculation code, and then in the pdf.php file include
if ($commentCode=='MAIN){ etc.
I should be able to make the switch? This is what I have tried, and the variable value does appear to be available in the pdf.php file. Is there a variable scope issue I need to deal with? Or is the variable in the calculation area included in another entity that I need to access (for example, $bob.calc.CommentCode)?
Thanx.

Moonsoft support 2011-12-23 17:14:25

Hello,
yes, when handling variables through different server requests, you need to store the values in a persistent way, using 'session' variables. In Jjoomla session is supposed to work this way:

Store value:

$session =& JFactory::getSession();
$session->set('name', "value");

Now you can retrieve this session variable using:

$session =& JFactory::getSession();
$myvar= $session->get('name');



Hope this helps, best regards
Moonsoft Team

...
Support/development 40 hours

With the peace of mind of having a professional team at your service (20% discount)

Buy now!
...
CalcBuilder

Create dynamic calculators

Buy now!