I'm using contemplate with jstools tabs module. I'm trying to change the layout of fields inside each fieldgroup, so I thought it to be the solution I was looking for.
I'm trying to change (first) the way the Body view looks like. I found the post in http://groups.drupal.org/node/8359 to be very useful to get the following code for the template:
<div id="tabs-1" class="drupal-tabs">
<ul class="anchors">
<li><a href="#tabs-tabset-1">Tab1</a></li>
<li><a href="#tabs-tabset-2">Tab2</a></li>
</ul>
<div id="tabs-tabset-1" class="fragment">
<h2 class="drupal-tabs-title">Tab 1</h2>
<?php print $node->content['field_somefield']?>
</div>
<div id="tabs-tabset-2" class="fragment">
<h2 class="drupal-tabs-title" >Tab 2</h2>
<?php print $node->content['field_someotherfield']?>
</div>
As can be seen, I'm trying to show the $node->content['field_XXX'] variables (which, as the 'body variables' link states, are available) but nothing is printed. But if I replace them with something like $node->field_XXX[0]['view'], this value is shown.
Is this an issue? or am I doing something wrong?
Comments
Comment #1
jlalvarezmedina CreditAttribution: jlalvarezmedina commentedsilly me! I forgot to prepend ['fieldgroup_tabs']['group_groupname'] before ['field_XXX']. Now it works like a charm :)
Mental note: have it in mind if you're working with cck fieldgroup tabs
Comment #2
Axmo CreditAttribution: Axmo commentedHi,
I have the same problem and your solution doesn't work for me.
I work with Drupal 7.
I have custom fields to describe me content.
If I do that, it's work :
$node->field_custom[$node->language][0]['value'] = "foo";
But if I want to change my field name or to add a field without change my module code, I think it can be usefull to use $node->content
But those 2 solutions don't work :
$node->content['field_custom'][$node->language][0]['value'] = "foo";
$node->content['fieldgroup_tabs']['group_desc']['field_custom'][$node->language][0]['value'] = "foo";
Any ideas
Thanks
Axmo