I'm having a little difficulty with tabs, I am able to get them rendered and whatnot but I need a bit of a point in the right direction as to the proper syntax.
I am implementing CCK for a custom content of type (Resort). I have created a great form to enter a myriad of fields they all work fantastically....
I went one step further and created a template for this node type (with contemplate) which also works great. I am able to place hooks for all the fields in the manner I like with all my custom html/js/css and whatnot; it works great.
I created a tabs set in the template page which works great see code below. Heres the thing, my code only works when I place one hook in the '#content' => !!in here!!, All of my tabs setup that way work great but I need one of the tabs to be a little more complicated. I need it to have some html/css structure containing many other hooks.
What is the correct way to structure the syntax here to render my tabs? The code below is a form array; is there a better way? How would I add a variable to the tabs structure that calls a separate set of markup? You can see in the code below on "tab4" I was able to implement something close using $tab_A to call a node where I tried to place my markup. The problem is that it simply shows a text output none of the hooks I placed are executed.
If anyone could help I would greatly appreciate it.
Below is my tabs code; Which I place in my body template for this content type I trimmed everything out but the tabs stuff.
<div id="prop_tabs">
<?php
$node_1 = node_load(array('nid' => 22));
$tab_A = $node_1->body;
$form = array();
$form['example1'] = array(
'#type' => 'tabset',
);
$form['example1']['tab1'] = array(
'#type' => 'tabpage',
'#title' => t('Overview'),
'#content' => $node->field_prop_overview[0]['view'],
'#weight' => '-8',
);
$form['example1']['tab2'] = array(
'#type' => 'tabpage',
'#title' => t('Onsite Amenities'),
'#content' => $node->field_onsite_amenities[0]['view'],
'#weight' => '-7',
);
$form['example1']['tab4'] = array(
'#type' => 'tabpage',
'#title' => t('Points Grid'),
'#content' => $tab_A,
'#weight' => '-5',
);
$form['example1']['tab5'] = array(
'#type' => 'tabpage',
'#title' => t('More Details'),
'#content' => $node->content['group_more_information']['#children'],
'#weight' => '-4',
);
return tabs_render($form);
?>
</div>
Is there a way to add my custom code to the top part like below? So then I just add the $tab_A variable to the '#content' => part in the script and it adds and executes into the tab?
$tab_A =
<div id="mydiv">
<table>
<tr>
<td><?php print $node->field_something[0]['view']?></td>
<td><?php print $node->field_another[0]['view']?></td>
<td><?php print $node->field_more[0]['view']?></td>
</tr>
<tr>
<td><?php print $node->field_another_field[0]['view']?></td>
<td><?php print $node->field_another_one[0]['view']?></td>
<td><?php print $node->field_and_another[0]['view']?></td>
</tr>
</table>
</div>,
Comments
Comment #1
Macronomicus commentedIs there a way to call your tabs module without using the $form = array(); ?
Comment #2
Macronomicus commentedOkay I have added a function to my template.php page which should output a simple version of what I am trying to do...
Then on my content type body template ive called the function inside your forms api tabs script. Nothing comes up in that tab.
I was sure this would work ... is there something that I have glaringly wrong here? My main goal is to use my body template for this content type to call the tabs, inserting the hooks to ender fields. The problem is that in one of the tabs I need to fully customize the layout with about 20 separate fields.
Am I missing something important about using your module?
Comment #3
liquidcms commentedi think you should not do a return.. but a print of the
so, possibly try this at the end:
after creating array
Comment #4
Macronomicus commentedThanks for the tip on that ... it seems that does help quite a bit. However I have solved this by using a better tabs script, for me at least..... There is really no need to use the $form method, for what I am doing it was only complicating things.
The code below is similar to what im using in my template tpl files. Im sure the $form method must be more useful for more dynamic tab sets, but this works perfect for me.
Comment #5
liquidcms commentedi just started using this module and find it very easy to use. Combined with view_buid_views like this:
I very quickly made up an A-Z (and #) artists selector which pulled in a filtered view based on the tab index letter.
Very nice. :)
Comment #6
Macronomicus commentedThats sweet!
I've only just begun to use views, Im loving them so far. I can see how the forms method can be useful when you want a yet to be determined amount of tabs to be generated. I will toy around with your code, as it seems a better approach in the long run.
I just needed something to work, right now, lol, so I came up with the shortcut above. Thanks for the tips!
Comment #7
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.