CalcBuilder Forum

Load different module position based on value

User Rvdzande 2021-04-05 17:34:30

Hi,

Just checked into your extention. Have to say it works well, but it takes a bit to get into. I find it hard finding my way through the documentation, but will learn step by step.

I have a very simple calculation:
$Blijven_zittenvalue=10;
if($Blijven_zitten=="Y"){
$resultaat2=$resultaat+$Blijven_zittenvalue;
}
$Resultaat=$Leerjaar+$Maand+$resultaat2;

This, based on values I provided, works.

The output / result can be between 1 and 100. Maybe in steps of 10, maybe in steps of 1 (still have to decide).

Based on the result I want to display specific information. Do you think this is possible?

So if result = 31 display moduleposition31
If result = 55 displaymoduleposition55

Thanks in advance!

Moonsoft support 2021-04-06 09:39:16

Hi,
ok, if we undestand properly you will have several different sections that will contain different information, and you want to show one of them, depending on the result of the calculator. We'd suggest the following approach:
- Create your output at the output section adding all different sections using default html, and each one with a different style property, like this

div id="myresult1" style="display:##display1##"


div id="myresult2" style="display:##display2##"

...etc

- At the code section, you will 'hide' them all by default at the beginning of the code:
$display1="none";
$display2="none";

...etc

- At the end of your code you will know which section do you want to show, so you will set it visible, for ex, section 3

$display3="block";

You can use expressions , for ex (if result=37, display section 30)

if($Resultaat==37) $display30="block",

There are many other ways to achieve this same goal, but they will require more complex code, javascript code, or database access...etc, this one should do the work. Let us know if you need further help with this.

Thanks, regards
Moonsoft Team

User Rvdzande 2021-04-06 18:49:42

Hi,
ok, if we undestand properly you will have several different sections that will contain different information, and you want to show one of them, depending on the result of the calculator.


Correct!

Hi,
- Create your output at the output section adding all different sections using default html.


Output section can just be any module / text block on the site?

Will look into the proper HTML code later this week.

BTW: if needed do you offer custom (paid, off course) support?

Thanks in advance!

Moonsoft support 2021-04-07 09:30:17

Hi,
showing other module as a result is not a setting available by default, the calculator result should be built using the calculator option 'exit layout'. But using the code section you could try to get the module content html and display as a result. Here the code tips to get the content of a custom html module you have created using the core Joomla module system. Let's state you want to show the content of the module named 'mycustom1', with title 'CustomTitle1', at the code section, you'd write:

$module = JModuleHelper::getModule("mycustom1","CustomTitle1");
$result=$module->content;

And at the calculator result (exit layout), you'll show ##result## in order to print the contents.

You only need to ensure the module is published and set to show on current page. In order to hide it by default at the page, set it to a non-used or custom position so it will only show when you request it from the calculator.

If at any time you prefer us to configure your calculator or add custom coding, we have a custom calculator service available, you can freely ask for a quote adding your requirements to a private ticket at the helpdesk of your dashboard.


Hope this helps, regards
Moonsoft Team

...
Support/development 10 hours

Get a bigger amount of hours for more complex tasks and get a 10% discount

Buy now!
...
Support/development 40 hours

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

Buy now!