CalcBuilder Forum

Code for showing matrix values in exit layout in an orderly presentation

User adk 2018-11-16 12:08:48

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.


Moonsoft support 2018-11-16 17:16:53

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:

and one example that you could use as template at the build_table function explained here:

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

Support/development 40 hours

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

Buy now!
Support/development 10 hours

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

Buy now!