Hi,
thanks for your post, and sorry for the trouble.
The problem here is that the formulas are evaluated before the PHP code. Thus, the formula sees the code and not the number. To achieve that, you would have to modify the filter hook in the PHP in Tables Extension, so that it e.g. runs on the array values of the tablepress_table_raw_render_data hook, defined here: https://github.com/TobiasBg/TablePress/blob/master/classes/class-render.php#L119
Regards,
Tobias
Thread Starter
erwant
(@erwant)
Hi thank you ,
could you just help me to understand where are the PHP table extension.
Thank you
Hi,
the Extension that you are already using to display a value: https://tablepress.org/extensions/php-in-tables/
Regards,
Tobias
Thread Starter
erwant
(@erwant)
Hi Tobias, I tried tout solution but can’t find the way to make it work.
Could you please help me a little bit more ?
Thank you very much
Erwan
Hi,
unfortunately, I’m very busy and don’t have the time to develop the full solution for you.
If you check the source code of the PHP in Tables Extension, you will see that it runs on every cell via the tablepress_cell_content filter hook.
You should change that, so that it runs on every cells of the $table['data'] array that you get when instead hooking into the tablepress_table_raw_render_data filter hook.
Regards,
Tobias
Thread Starter
erwant
(@erwant)
Thank you Tobias,
This is what I did, but it doesn’t work. 🙁
I replaced tablepress_cell_content by tablepress_table_raw_render_data in TablePress Extension file: tablepress-PHP-in-tables.php
I understand that this will execute php in table extension when $this->table = apply_filters( ‘tablepress_table_raw_render_data’, $this->table, $this->render_options ); is called but when I do that, save table in backend office and then update my website page it doesn’t display anything.
The fact is this feature is really important for me, I am blocked in finding a solution for what I want to do. I understand that you are very busy in pluggin development, but could I have your help so I can go ahead on my project.
Thank you very much
Hi,
just changing that filter is not sufficient. The tablepress_table_raw_render_data hook gives you an array, while tablepress_cell_content gives you a string. You will need to add an intermediate function that loops through the array cells and call the original function on those.
Regards,
Tobias