Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
Roulion CreditAttribution: Roulion commentedI 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
Comment #2
Andy Langton CreditAttribution: Andy Langton commentedI'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
Comment #3
Roulion CreditAttribution: Roulion commented<
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
Comment #4
l0calh0rst CreditAttribution: l0calh0rst commentedah thanx, didn't know it was simply serialized. Stupid me!
Comment #5
Clint Eagar CreditAttribution: Clint Eagar commentedCould you provide an example of how you used the unserialize function to do this?
Comment #6
upupax CreditAttribution: upupax commentedYou 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'];
Comment #7
carlovdb CreditAttribution: carlovdb commentedHow 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.
This gives me this.
Comment #8
lolandese CreditAttribution: lolandese commentedClosing 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.