Hello,

i'm having trouble with the output of a table field in a printer friendly version. I am using the module print which doesnt seem to support views. So all I get is..

a:12:{s:8:"cell_0_0";s:7:"Deutsch";s:8:"cell_0_1";s:0:"";s:8:"cell_1_0";...

How can I render the actual html table from this please?

Thank you

Comments

Roulion’s picture

I use the contemplate module and is there a way to be able to access each cell with a call such as
print $node->field_name_of_my_field[0]['view'][0][0];

thanks for your help

Andy Langton’s picture

I'm having the exact same issue. This seems to have changed with the most recent update to the module. Previously, a complete HTML table was available in templates at:

$node->cck_tablefield_name[0]['view'];

For some reason it seems like much less data is available in the $node object in print templates now.

Andy

Roulion’s picture

<
l0calh0rst, you can use the userialize function to get your fiel in an array
http://fr2.php.net/manual/fr/function.unserialize.php

Then it's easy to parse your array as you want

l0calh0rst’s picture

ah thanx, didn't know it was simply serialized. Stupid me!

Clint Eagar’s picture

Could you provide an example of how you used the unserialize function to do this?

upupax’s picture

You can simply build the node content like:

$content = node_build_content($node);

and then access the tablefield with:

print $content->field_tablefield_name[0]['value'];

carlovdb’s picture

Issue summary: View changes

How can this be done in drupal 7.

I have achieved to display the raw value of this tablefield in views-view.tpl.php but not in table format.

$view = views_get_current_view();
$node =  node_load( $view->args[0] );
$table = $node->field_modal_parameters_tabel[und][0]['value'];
print $table;

This gives me this.

a:34:{s:8:"cell_0_0";s:1:"N";s:8:"cell_0_1";s:21:"nat. freq. meas. [Hz]";s:8:"cell_0_2";s:22:"&xij";s:8:"cell_0_3";s:1:"N";s:8:"cell_0_4";s:21:"nat. freq. calc. [Hz]";s:8:"cell_0_5";s:17:"damping calc. [%]";s:8:"cell_0_6";s:7:"MAC [-]";s:8:"cell_0_7";s:11:"delta f ....

lolandese’s picture

Status: Active » Closed (won't fix)

Closing as "Won't fix" because the Drupal 6 version is unsupported and the issue doesn't seem to appear on Drupal 7 or 8. If you believe it does, feel free to reopen the issue and change the version as appropriate.

Of course you can also reopen the issue if you provide a patch that fixes the issue.