I'm trying to implement tabs through the Javascript Tools Module. I've read through everything I can find, but I don't know where to start. I know html and css well but I'm just getting started on PHP and Drupal. The implementation on a normal site is very simple, but I just don't know where to get started to call the function theme_tabs_tab_page.

Do I need to make a new content type where I input these "calls"? I've tried adding the link to the tabs javascript and css files in page.tpl.php as explained here, but that does nothing in Drupal.

Thanks,

Neum

Comments

nedjo’s picture

* enable the tabs module
* enable the page module, log in as a user with admin access, and create a new piece of content ('node') of type 'page'
* for 'Input format', select 'PHP code'
* put the following as the page's content:


  $tabs .= theme('tabs_tab_page', t('First tab'), t('This is the first tabbed page'));
  $tabs .= theme('tabs_tab_page', t('Second tab'), t('This is the second tabbed page'));

  $output = theme('tabs_tabset', 'example', $tabs);

  print $output;

worthy’s picture

Thank you for that, it works great. For some reason I could not get it to work if I was using tinyMCE, even having the input set to PHP code. I tried putting the code in the html popup of tinyMCE and several other changes but it wouldn't work. So I disabled tinyMCE and it works great.

Thanks again.

nedjo’s picture

Glad it's working, but I'd like to track down the tinyMCE conflict issue.

If you have a moment, please reneable tinyMCE, view the tabs page in Firefox, and look for Javascript error messages (Tools > Javascript console). Is there anything there?

Thanks.

worthy’s picture

I finally got a chance to reenable tinyMCE and there are javascript errors. There is a bunch of them as soon as I go to add a page node.

Some of these are

Error: Unknown property 'filter'. Declaration dropped.
Source File: modules/tinymce/tinymce/jscripts/tiny_mce/themes/advanced/css/editor_popup.css
Line: 139

and a bunch more like that. It's doing really weird things, after I try and add the code to the html pop-up area. After I add the code tinyMCE disappears and it is just the standard editor. I think that my tinyMCE install somehow got corrupted. I'm going to uninstall it drop the tables and then I'll set it back up again and let you know how it goes.

Thanks for the fast answers.

kpaul’s picture

and most of the other wysiwyg's you have to turn off or view 'source/html' mode and paste it then. if not, tinymce strips and chops the code... ;)

-kpaul

worthy’s picture

Any idea how I could go about switching the tabs css theme?

nedjo’s picture

see admin/settings/tabs or you could edit the files in tabs/css.

wolfderby’s picture

Admin/settings/tabs goes no where for me in D5. Is that still supposed to be there? I have functioning tabs on my site, I'm just looking to change the look of them so that they have lines around the tabs, making them look more like tabs.

I don't know css very well so any help would be greatly appreciated. I've already spent hours trying to do this!

mgifford’s picture

I got the heads up about this AJAX module from Zack@CSL. Anyways, this was what I needed to implement this module for the site I was working on. Extended this a bit to include information on how to draw in other nodes:
http://www.openconcept.ca/fun_with_drupals_ajax_tabs

The last think you want to do is set up AJAX tabs that your site admins can't administer through their WYSIWYG tools.

Mike
--
Mike Gifford, OpenConcept Consulting
Free Software for Social Change -> http://openconcept.ca
http://learningpartnership.org http://ox.ca http://poped.org http://openoffice.ca

pathscollide’s picture

I would suggest an alternative based on mgifford's code to pull other nodes into tabs. Sometimes you don't want the whole themed node, because it may contain structure and style that messes up the tabbed display. I had this problem with the Multiflex theme: using the "themed node" approach, I basically got a node within a node, with several repeated divs, etc. and the tabset only displayed at a height of about 1 text line, while the node body text overflowed below it. It looked awful.

The solution was to pull in only the node *body* as follows:

$node_1 = node_load(12);
$tabs = theme('tabs_tab_page', 'First tab title', $node_1->body);
$node_2 = node_load(13);
$tabs .= theme('tabs_tab_page', 'Second tab title', $node_2->body);
print theme('tabs_tabset', 'example', $tabs);

(Compare with mgifford's original code):

$node_1 = node_load(12);
$tabs = theme('tabs_tab_page', $node_1->title, theme('node', $node_1, $teaser = FALSE, $page = TRUE));
$node_2 = node_load(13);
$tabs .= theme('tabs_tab_page', $node_2->title, theme('node', $node_2, $teaser = FALSE, $page = TRUE));
print theme('tabs_tabset', 'example', $tabs);

[For other newbs: the code has to go into a node (e.g. a page) with input type set to PHP.]

imp_squared’s picture

<?php
  $tabs = array();
  $tabs[] = array(
    '#title' => t('One'),
    '#content' => t('First tab content.'),
  );
  $tabs[] = array(
    '#title' => t('Two'),
    '#content' => t('Second tab content.'),
  );
  $tabs[] = array(
    '#title' => t('Three'),
    '#content' => t('Third tab content.'),
  );
  
  return theme('tabs_tabset', $tabs);
?>

How would I convert the above code to pull nodes into a tab??

Who Am I?? www.joeliang.ca

evilclown’s picture

Hi,

I can get the tabs to work, I cant however get them to load nodes:

I want 3 tabs on a page, each one pulling in a different node, to form pages with grouped info.

Any ideas how I would achieve this ?

Thank you kindly.
Shaun

evilclown’s picture

Hi,

Any idea how would I do this in drupal 5?

Thank you kindly

najibx’s picture

How this is done in drupal 5.x?


<?php

/* Get content from node ID
/* How to do this? ***********************/
  $node_1 = node_load(22);
  $tab_A = theme('block', $node_1->body);
  
  $node_2 = node_load(23);
  $tab_B = theme('block', $node_2->body);
  
/* How to do this? ***********************/
  
  $form = array();
  $form['power-quality'] = array(
    '#type' => 'tabset',
  );

  $form['power-quality']['tab2'] = array(
    '#type' => 'tabpage',
    '#title' => t('Handheld'),
    '#content' => $tab_A,
  );
  $form['power-quality']['tab4'] = array(
    '#type' => 'tabpage',
    '#title' => t('Softwares'),
    '#content' => $tab_B,
  );

  return tabs_render($form);
?>

-najibx-

nedjo’s picture

1. http://drupal.org/project/views_tabs

2. http://drupal.org/node/160392 (currently a patch, likely to be adopted soon in Panels module)

dhayalan_ms’s picture



  $node_1 = node_load(array('nid' => 22));
  $tab_A =  $node_1->body;
 
  $node_2 = node_load(array('nid' => 23));
  $tab_B = $node_2->body;
 
/* How to do this? ***********************/
 
  $form = array();
  $form['power-quality'] = array(
    '#type' => 'tabset',
  );

  $form['power-quality']['tab2'] = array(
    '#type' => 'tabpage',
    '#title' => t('Handheld'),
    '#content' => $tab_A,
  );
  $form['power-quality']['tab4'] = array(
    '#type' => 'tabpage',
    '#title' => t('Softwares'),
    '#content' => $tab_B,
  );

  return tabs_render($form);

it works good.......

Associate Architect
Indecomm Global Services

Drupal_’s picture

How would I create tabs for the fields I have in a view/block.

thnx

ktonini’s picture

this does not work for me. Possibly because I'm usinf drupal 5, but i get this error:

* warning: Invalid argument supplied for foreach() in /Library/WebServer/Documents/drupal/sites/all/modules/jstools/tabs/tabs.module on line 13.
* warning: Invalid argument supplied for foreach() in /Library/WebServer/Documents/drupal/sites/all/modules/jstools/tabs/tabs.module on line 19.

nedjo’s picture

... the way it's used has changed. This should work:


  $tabs = array();
  $tabs[] = array(
    '#title' => t('One'),
    '#content' => t('First tab content.'),
  );
  $tabs[] = array(
    '#title' => t('Two'),
    '#content' => t('Second tab content.'),
  );
  $tabs[] = array(
    '#title' => t('Three'),
    '#content' => t('Third tab content.'),
  );
  
  return theme('tabs_tabset', $tabs);

Chris Lozinski’s picture

Thanks for this Nedjo, this tabs function is a great addition and works like a dream.

Do you know whether the other variants of tab styles as shown in the demo at, http://stilbuero.de/jquery/tabs/ are available to Drupal and if so, any pointers on how to access them?

Regards

Chisel

knariks’s picture

Hi Nejdo,

I have tried using this with drupal 5.7 and it does not seem to work. Could you please tell me how to put tabs in content items for Drupal 5.7 ?

I have got it working with the tabs_render function as outlined in the comment http://drupal.org/node/62998#comment-860448 .

However, it would be much better for me if I can just use the method you suggested instead of using form API.

Thanks,

yusrijal’s picture

In drupal 5.2

I enable the tabs module
and enable the page module, log in as a user with admin access, and create a new piece of content ('node') of type 'page'
* for 'Input format', select 'PHP code'
* put the following as the page's content:

  $tabs .= theme('tabs_tab_page', t('First tab'), t('This is the first tabbed page'));
  $tabs .= theme('tabs_tab_page', t('Second tab'), t('This is the second tabbed page'));

  $output = theme('tabs_tabset', 'example', $tabs);

  print $output;

:

and it didnt work..? please help me what to do..

nedjo’s picture

http://drupal.org/node/62998#comment-189583

Or, if you're using the Forms API, see the sample module that's included in the 5.x dev and HEAD downloads,

http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/jstools/tab...

GreenLED’s picture

I'm just about pulling out my hair right now. I simply do not have the guts to pull this off or something. Here's what I've done so far...

[1] Downloaded: Javascript Tools
[2] Uploaded To "Modules"
[3] Enabled Module "Javascript Tools"
[4] Enabled Module "Tabs" Under Javascript Tools
[?] What's the "Page" Module, I have none called this.
[5] I entered your php code above, what I got was this.

In IE it shows up as a list.
I must be an idot or something.
I just can't get this one to work.

Give me a checklist please or some
tips or something. I just want some
tabs, lol. I've been through every
tab reference I can think of on Google
and I just can't get the thing to work.

Much appreciated.

» Respectfully, GreenLED
» Stable Files . net

delmont’s picture

A Drupal noob, I can't figure out if it's possible to place the content of two or three blocks into this Javascript tabbed pane.

For example, I've gotten the tabs to work--nice module, by the way--with simple text content in block made on-the-fly. But what I'd like to do is take the content of three blocks and put one in each tab.

For example, I'd like to make tab 1 contain the content presented by "Highest Rated Nodes" module/block, make tab 2 contain the content presented by "Most voted for nodes" module/block and make tab 3 contain the content generated by the Poll module/block.

I'd like to do this without hacking any of the modules themselves.

Ideas?

Thanks!

nedjo’s picture

This sort of thing you'd do in a theme. Edit e.g. a page.tpl.php file for a PHPTemplate theme. You'd make the tabs manually rather than through a theme() call. Copy the HTML rendered for a tabset, and then for the tab page content put your block. You'd need to test for each block, incrementing an index counter only if there was content for the block.

worthy’s picture

Is it possible to link to a tabbed page but also to have a specific tab selected? If so, how would I do that?

This is a great module by the way, I'm using a couple of items in it and they work great!

nedjo’s picture

That way the module author is more likely to find the request, and others are more likely to see it.

worthy’s picture

I don't even know where to file a support request issue on a module. I've gone to the javascript tools module page and I don't see anything like support request. Is it request new feature? or report new bug? When I click on support forum it just takes me to the main forum tree. I couldn't find a forum specifically for javascript tools, but like I said I'm new to all this.

I'll try and put it as a feature request, but please correct me if that's the wrong spot. I'm not trying to make this hard for anyone.

Thanks again for all the help.

worthy’s picture

It's on the module page and just click the link "view pending feature requests" and there you can add one. (For those other noobs who don't know where to find this stuff)

It has been added.

bushhog’s picture

I have tried and tried to get tabs to show up. Dont know what else to try, I have tried most all of the stuff here. Been to the links in the post and went to jquery website and read it. Messed with some of the other stuff it can do with no problem, just cant get this tab thing down.
I have put this in the head of page.tpl.php (Aquasoft thme) Drupal5
/misc/jquery.js
/modules/jstools/tabs/tabs.js

$(document).ready(function() {
$.tabs("container");

I am using front page module and put this in there.

div id="container"
ul class="anchors"
li a href="#Site-News" Site News /a /li
li a href="#Inbox" /a /li
/ul
/div
and then separate nodes one as #site-news and #inbox
is this right? I would greatly appreciate any help!

Like i said a real newbie please be easy on me.

SirBerberitz’s picture

Hi there,

could somebody please explain how to implement this modul into "User Profiles Version 2" (http://shellmultimedia.com/tutorials/user-profiles) as I have no clue which file I have to edit that this module is shown up correctly?

Do I have to edit "template.php" or perhaps "node-uprofile.tpl.php"?

Thanks in advance for giving a hint.

SirBerberitz

najibx’s picture

But, I have been doing tabs (provided by JS tools) together with tab panel + panel mini + panel. User Profiles Version 2 would be nice to be presented in tabs isn't? Michelle is planning to come out with User Profiles Version 3, is she planning to use tabs?

-najibx -
Drupal developer in Malaysia

mikepadiernos’s picture

As I see above majority of the code are based on nodes. What I've been searching for is a way to insert "pages" such as the faq into a tab. I've tried the views and the panel modules but they don't have that as options. I was thinking of creating a page with tabs leading to differnt types not just nodes. So far I've been unsuccesfully in my trials.

nedjo’s picture

and the panels tabs style module, http://drupal.org/project/panels_tabs

hendryman’s picture

can one of the real drupal wizards please post nedjo's code (item 2 of this thread) updated so that it works with drupal 5.5? would be very much appreciated... thanks a lot

drupalnewbiehaha’s picture

I tested nedjo's code on my drupal site (5.6), it works pretty well. Have you changed example to the name of what you are trying to tab?

$output = theme('tabs_tabset', 'example', $tabs);

knariks’s picture

Hi ,

Could you please tell me the exact usage for this to get it working in 5.6 or 5.7 .. ? What do you mean my changing the name of example to what you are trying to tab ? How can I just get a few tabs in my content item ?

Thanks,
Knariks

that0n3guy’s picture

I have been using the following code on my drupal 5.6 site and it works perfectly. My question is can you use an image for the tab, instead of just the text?

For example, instead of having the tab just display "Online Products" (from the code below) have it display a nice rounded button with fancy lettering to display "online products"

(the code I am using)

<?php
  $node_1 = node_load(array('nid' => 4));
  $tab_A =  $node_1->body;

  $node_2 = node_load(array('nid' => 2));
  $tab_B = $node_2->body;

/* How to do this? ***********************/

  $form = array();
  $form['power-quality'] = array(
    '#type' => 'tabset',
  );

  $form['power-quality']['tab2'] = array(
    '#type' => 'tabpage',
    '#title' => t('Software Products'),
    '#content' => $tab_A,
  );
  $form['power-quality']['tab4'] = array(
    '#type' => 'tabpage',
    '#title' => t('Online Products'),
    '#content' => $tab_B,
  );

  return tabs_render($form);
?>
scottrigby’s picture

can I subscribe to this thread? I'd love to know how to do this too!
Thanks!
Scott

p0732658’s picture

I've been using this code with D6 to display nodes in tabs. How could I adapt this to display block instead of nodes in differents tabs?

Thank you!

p0732658’s picture

Anyone ?

ipwa’s picture

You can go to this page in a test site I'm building and you'll see tabbed pages with the tabs from the jquery tabs plugin: http://forensic.ipwa.net/node/11

I used the code you posted to call nodes inside my tabs, it works well in most browsers except IE6. In IE 6 the whole page shifts when you click the second tab, any help to solve this would be greatly appreciated.

For the jquery tabs plugin style to work I had to hack the tabs module a little bit, in the tabs.module I changed the function that returns the rendered tabs in lines 118-135.

From:

/**
 * Return rendered tabset.
 *
 * @themable
 */
function theme_tabset($element) {
  $output = '<div id="tabs-'. $element['#tabset_name'] .'"'. drupal_attributes($element['#attributes']) .'>';
  $output .= '<ul class="anchors">';
  foreach (element_children($element) as $key) {
    if ($element[$key]['#type'] && $element[$key]['#type'] == 'tabpage') {
      $output .= '<li'. drupal_attributes($element[$key]['#attributes']) .'><a href="#tabs-'. $element['#tabset_name'] .'-'. $element[$key]['#index'] .'">'. $element[$key]['#title'] .'</a></li>';
    }
  }
  $output .= '</ul>';
  $output .= $element['#children'];
  $output .= '</div>';
  return $output;
}

To:

/**
 * Return rendered tabset.
 *
 * @themable
 */
function theme_tabset($element) {
  $output = '<div id="tabs-'. $element['#tabset_name'] .'"'. drupal_attributes($element['#attributes']) .'>';
  $output .= '<ul class="tabs-nav">';
  foreach (element_children($element) as $key) {
    if ($element[$key]['#type'] && $element[$key]['#type'] == 'tabpage') {
      $output .= '<li'. drupal_attributes($element[$key]['#attributes']) .'><a href="#tabs-'. $element['#tabset_name'] .'-'. $element[$key]['#index'] .'"><span>'. $element[$key]['#title'] .'</span></a></li>';
    }
  }
  $output .= '</ul>';
  $output .= $element['#children'];
  $output .= '</div>';
  return $output;
}

The changes I made was to change the anchor class to tabs-nav. The other change was to add a span inside the link on the list items, this is how the CSS applies the main background for the tabs, they use the sliding doors technique.

The next step was to download the plugin at: http://stilbuero.de/jquery/tabs/

Open the jquey.tabs.css and copy all the css and add it to your theme's css, or copy the file and call it from your template, also copy the tabs.png image to your theme folder.

I changed the tabs-nav class on the CSS:

From:

.tabs-nav {
    list-style: none;
    margin: 0;
    padding: 0 0 0 4px;
}

To:

.tabs-nav {
	border-bottom:1px solid #97A5B0;
	border-collapse:collapse;
	height:25px;
	line-height:normal;
	list-style-image:none;
	list-style-position:outside;
	list-style-type:none;
	margin:5px;
	padding:0pt 0pt 0pt 1em;
	white-space:nowrap;
	}

You may need to adjust the height.

HTH

Nicolas
-------------------------
http://nic.ipwa.net

Nicolas
-------------------------

ersaky’s picture

thanks ipwa

ipwa’s picture

I'm glad it helped someone!

Cheers!

Nicolas
-------------------------
http://nic.ipwa.net

Nicolas
-------------------------

esplinter’s picture

hi

I installed jstools and activated the tab module.

I disabled fckeditor.

I test that my user belongs to "admin" role who has access to the php-input format.

then I create a new page, select php as input format but the page keeps blank, I cant see anything on it. I have tried different examples on this post.

I am using drupal 5.7 and the last version of jstools.

¿any clue about what I am doing wrong??
many thanks in advance for any help.

GreenLED’s picture

I don't know much about that module, but I can tell you -- from my own experience the tabs created by this module are not really -- at least for me -- up to my standards -- they don't show up as I expected them too. If you're expecting them to show up just exactly like the tabs do for example when your administrating -- they don't. I would recommend using Views to create tabs. What's nice about this method is you ONLY need Views, and yes CCK. If you want a detailed way to do it, let me know and I'll post it here. Just thought I'd mention it.

wkteng’s picture

Hi GreenLED,

I'm new to Drupal and I've been spending hours trying to create tabs using Views but have no luck :(
I would like to do both:
1. divide the content of a node into multiple tabs
2. put contents from different nodes into multiple tabs of a page

Appreciate if you could give me some detailed steps as I'm still having hard time to understand Durpal completely.

Thanks!

GreenLED’s picture

I fele your pain. I was quite frustrated with JavaScript tools -- to say nothing of disappointed because it did not deliver what I was expecting. The best way to get some more confidence in Drupal is with examples... Therefore ... create a new view. I've listed the settings below. Match up the settings with the listed secitons. You'll get it once you get going. So, open a window now pull up "Views" and hit add ... then start popping these settings in there...

Don't try to figure it out yet -- just start inputting . . .

1: Create The Content Type -- Create a content type with the following settings.

Name: Event
Type: event
Body field label: (leave blank)
Workflow: (un-tick) Promoted to front page

The rest disable or set to your liking.

2: Create Your Fields -- Create 3 cck fields with the following settings.

Name: event_guests
Field type: Text Field
Label: Guests
Rows: 10
Text Processing: Filtered text

Once you've created the first field. The next two are exactly identical. Simply replace event_guests with event_schedule and event_details. Don't worry about settings that I have not noted. Just fill in the ones I have. So, when you're done you'll have a total of 3 fields in your "Event" content type called "event_guests, event_schedule" and "event_details"

Ok. Now that where done with that... Go ahead and input some fake data into a node. So -- "Create" > "Event" Once you've inputted some imaginary data -- view the node to make sure it go in there. Next -- follow the next steps below. Now that we have our data -- we're simply going to play around with how it appears... The fun part basically...

3: Create Your Views -- Create 2 views with the following settings. What you want to do here is create one view with the following settings, then simply clone that view and adjust the noted names ... I'll explain below.

( basic information )

Name: event_schedule

( page )

Provide Page View ... check this
URL: node/$node-event/schedule
View Type: Full Nodes
Title: %1

( menu )

Provide Menu ... check this
Provide Menu as Tab ... check this
Tab Weight: 1
Menu Title: Schedule

( arguments )

Node ID ... add this argument by selecting it from the drop-down list, then hit "Add Argument"

( filters )

Node: Published: add this filter (dame way) and select "yes" under "value"

By creating this tab we've now designated a specific view for one tab. Go ahead and create 1 more views with the exact same settings -- making sure to replace every instance of "schedule" in your view with "details" Do you follow?

Ok. Now we're almost home. There is ONE more thing you have to do for this to work. After creating all of this stuff what you're going to end up with is a node with 3 tabs that has the exact same content on each page. Now we need to somehow format it so that when you are on a particular tab you get only what you want to see. Open your FTP client or get to the folder in your install named /themes/your-theme-name/

You should have a file called node.tpl.php. Download a copy of it. Rename the file to "node-event.tpl.php" The name IS important. Now what we're essentially going to do is tell drupal what to show on each tab. Copy and paste the following code into your file (node-event.tpl.php) making sure to completely delete everything that's currently in there. Then copy and paste the following.

<DIV CLASS="node
     <?PHP IF ($sticky)  { PRINT " Sticky"; } ?>
     <?PHP IF (!$status) { PRINT " Un-Published"; } ?>
     ">
     <DIV CLASS="content">

<?PHP SWITCH ( arg(2) )
      { case '':         PRINT $node->content['field_event_guests']['#value']; break;
        case 'schedule': PRINT $node->content['field_event_schedule']['#value']; break;
        case 'details':  PRINT $node->content['field_event_details']['#value']; break;
?>
     </DIV>
</DIV>

Keep in mind I have not tested any of this and you'll have to definitely get back to me with errors or what-knot. However, you'll enjoy these tabs when they are all working. You can view a live working example that I'm using with this setup right here The only "glitch" with this setup is that you have to change one little string in the node.module to edit the title of the "View" tab (you'll see what I mean later) to make it read what you want. Also, this setup does not really work well if you have multiple content types that you want to have ... well -- well take about that when it comes to it -- just try the above and we'll go from there.

wkteng’s picture

Thanks for the wonderful step-by-step guide!! it works flawlessly.

I wonder how the view that I created knows about the content type that's being applied to? is it by "-event" in argument "$node-event"? I've been trying to do the same thing by playing around Filters (Node: Type), was I going totally the wrong way?

I've been struggling with Views but the more I discover , the more I like it!

p/s: a closing curly bracket is missing for Case statement in the code.

GreenLED’s picture

Those closing brackets get me every-time. Thank goodness for error-reporting. *two thumbs up* I'm really geeked that it all worked for you. Enjoy. I'll answer in more detail in a little while. Enjoy!

wkteng’s picture

Hi GreenLED,

thanks again for the awesome guide! It gave me much better ideas of what Views is.
I think I found another way of creating tab using Views without coding on node-xxx.tpl.php
Following all your steps except for the settings below:
1. choose "Table View" instead of "Full Nodes"
2. In Fields section, add the field (eg. event_details) which you want it to be the tab's content
And, You will get a tab with the field's content you chose above.

Anyway, I am still looking forward to hearing from you regarding my questions in the previous post. I'm still in the progress to fully understand Views.

GreenLED’s picture

Anytime... You are correct. I actually used "List View" a while ago. The reason I did it the way I describe because I had a specific layout in mind and I did not want to go into "Theming Views" so I simply used the "node-x.tpl.php" route, but yes -- you can do that. You will find views to be insanely helpful.

» Respectfully, GreenLED
» Stable Files . net

JGO’s picture

Thanks, this is extremely useful !

wkteng’s picture

I'm facing the same problem too...using Drupal 5.7 and latest jstools. Could not get it work, the page is blank

GreenLED’s picture

Miszel’s picture

Does anybody know what is the simplest way of displaying a node edit form on a javascript tab?

I have the main node displayed on the first tab. Then I have a couple of other related nodes displayed on the other tabs. I want to have another tab to display the node edit form of the main node. How would you go about this?

najibx’s picture

Try ...

CCK Fieldgroup Tabs - Display CCK fieldgroups in tabs. Enables splitting up content onto tabs in both editing and display.
Depends on: Fieldgroup (enabled), Tabs (enabled)

Hope this help.

-najibx -
Drupal developer in Malaysia

wkteng’s picture

(reply to http://drupal.org/node/62998#comment-815359)

Thanks for the wonderful step-by-step guide!! it works flawlessly.

I wonder how the view that I created knows about the content type that's being applied to? is it by "-event" in argument "$node-event"? I've been trying to do the same thing by playing around Filters (Node: Type), was I going totally the wrong way?

I've been struggling with Views but the more I discover , the more I like it!

p/s: a closing curly bracket is missing for Case statement in the code.

silenceway’s picture

Sorry if i come late.
I was looking for tabs and i did found this module:
http://drupal.org/project/tabbed_block
:)
Byron H.

gerbil230769’s picture

Hi folks,
my first posting. Excuse me I am new to this. After days of hacking and reading I have finally got tabs working (at least in Drupal 5.3). The key step I was missing was to render the tabs. I don't know if I have to call the tabs_load() function. But thank God ... finally something that works. I just included this code in a simple Page, enabled PHP etc. Thanks and acknowledgements to other posts from which this code is 'hacked' together.


function tabsexample_form() {
  $form = array();

  $form['example1'] = array(
    '#type' => 'tabset',
  );
  $form['example1']['tab1'] = array(
    '#type' => 'tabpage',
    '#title' => t('One'),
    '#content' => t('First tab content.'),
  );
  $form['example1']['tab2'] = array(
    '#type' => 'tabpage',
    '#title' => t('Two'),
    '#content' => t('Second tab content.'),
  );
  $form['example1']['tab2']['tabset2'] = array(
    '#type' => 'tabset',
  );
  $form['example1']['tab2']['tabset2']['tab1'] = array(
    '#type' => 'tabpage',
    '#title' => t('One'),
    '#content' => t('First tab content.'),
  );
  $form['example1']['tab2']['tabset2']['tab2'] = array(
    '#type' => 'tabpage',
    '#title' => t('Two'),
    '#content' => t('Second tab content.'),
  );
  $form['example1']['tab3'] = array(
    '#type' => 'tabpage',
    '#title' => t('Three'),
    '#content' => t('Third tab content.'),
  );
  
  return $form;
}
//  tabs_load();
$output = tabs_render(tabsexample_form());
print $output;
GreenLED’s picture

Have you guys checked out my comment about creating tabs with cck and views? I think it will make you quite happy to find that you can create [b]system-like[/b] tabs without having to even install javascript-tools. Check it out »

» Respectfully, GreenLED
» Stable Files . net

Anonymous’s picture

Hey everyone,

anyone know how to do properly print the array of CCK multi-value fields inside the jstabs? See issue here: http://drupal.org/node/304152

JGO’s picture

This is extremely useful ! thanks !
(to GreenLED)