How to display node fields in tabs?

I have an โ€œactionโ€ content type that has three fields:

1- Programs 2- Implementation 3- Project Stories

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

Thanks!

+4
source share
4 answers

I found an easier way to do this using the field_group module. In Display Control, fields can be added to horizontal tabs, and then horizontal tabs can be added to a group of horizontal tabs. See Image for more information. enter image description here

+5
source

In my opinion, there are two ways to achieve this.

1) Using hook_menu () to create tabs for your content type. Here you will need 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; } 

Then you use the callback function to reflect on each tab.

2) Using Css and jquery to style the content so 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

+1
source

A quick search for the Drupal module gets the following:

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

0
source

Another module to consider if someone else is looking for an answer: http://drupal.org/project/node_subpages

[[shameless plug]]

0
source

Source: https://habr.com/ru/post/1386904/


All Articles