Forum


Calc Builder Support

Calc Builder support
Forums
Public write access is disabled. Please login

Code for showing matrix values in exit layout in an orderly presentation 16.11.2018 12:08

I would like to show the content op my matrix in a nice way in the exit layout.

I have tried with : $output=print_r($mymatrix); in the code section and ##output## in the exit layout section. But all the values of the matrix are printed one after the other and not presented in an orderly way in rows and columns.

Can you give the right PHP codes to achieve an orderly presentation of matrix values in the exit layout.

Regards,
AdK

Re: Code for showing matrix values in exit layout in an orderly presentation 16.11.2018 17:16

Hi
yes, the matrix is an array of values, so if you print it it will append all values. In order to show all contents in a user-friendly way you would need to add some more php, so you can build any kind of structured container in html (for ex a table, responsive divs, etc). You would need to loop through the rows and the columns while you concatenate a valid html, that's not a simple code for beginners but if you already have an average knowledge of php you could build such function using for/foreach instructions. Here the official docs in case you want to give it a try:

http://php.net/manual/en/control-structures.foreach.php

and one example that you could use as template at the build_table function explained here:
https://stackoverflow.com/questions/4746079/how-to-create-a-html-table-from-a-php-array

If you don't have php notions and your matrix has always same number of rows/cols you could also build the html structure at the exit layout and place each cell as a different 'result' of the calculator.

Hope this helps, regards
Moonsoft Team
www.moonsoft.es
Are you satisfied with our products/services/support?
Please help us to keep improving, add a review at  joomla extensions site and  magento connect

Our clients' feedback