perpetual_dream
perpetual_dream

Reputation: 1036

How to display node fields in tabs?

I have a content type "activities", which has three fields:

1- Programs 2- Implementation 3- Project Stories

How can I display each field in the node in a separate tab?

Thanks!

Upvotes: 4

Views: 9713

Answers (4)

Brock Boland
Brock Boland

Reputation: 16640

One other module to consider, if anyone else comes looking for an answer: http://drupal.org/project/node_subpages

[[shameless plug]]

Upvotes: 0

Allen
Allen

Reputation: 26

A quick search on Drupal moduels gets this:

D6 - http://drupalmodules.com/module/cck-fieldgroup-tabs D7 - http://drupal.org/project/field_group

Upvotes: 0

perpetual_dream
perpetual_dream

Reputation: 1036

I have found an easier way to do it using the field_group module. From "Manage Display" the fields can be added to horizontal tabs fieldgroups and then the horizontal tabs fieldgroups can be added to a horizontal tabs group. See the image for further information.enter image description here

Upvotes: 5

Vishal Khialani
Vishal Khialani

Reputation: 2587

In my opinion there are two ways you can achieve this.

1) Using the hook_menu() to create the tabs for your content type. Here you will have to write your own module and the code will look something like this

/**
* Implements hook_menu().
*/
function pages_menu() {
$items['pages'] = array( 
'title' => 'Menu system examples',
'description' => 'Menu system example that returns a string.',
'page callback' => 'pages_string',
'access callback' => TRUE,
);
$items['pages/default'] = array(
'title' => 'String',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
$items['pages/render-array'] = array(
'title' => 'Render array',
'description' => 'Menu system example using a render array.',
'page callback' => 'pages_render_array',
'access arguments' => array('access content'),
'weight' => 2,
'type' => MENU_LOCAL_TASK,
 );
 $items['pages/render-array/tab1'] = array(
'type' => MENU_DEFAULT_LOCAL_TASK,
'title' => 'Tab 1',
 );
 $items['pages/render-array/tab2'] = array( 
'title' => 'Tab 2',
'description' => 'Demonstrating secondary tabs.',
'page callback' => 'pages_render_array',
'access callback' => TRUE,
'type' => MENU_LOCAL_TASK,
 );

 return $items; 
 }

You then use the call back function to do your think in each of the tabs

2) Using Css and jquery to style the content in a way that it looks like a tab.

here is a great working demo for you. http://www.99points.info/2010/08/create-sexy-animated-tabs-using-jquery-and-css/

Cheers, Vishal

Upvotes: 1

Related Questions