Instructions on Tabs

Boletus - March 20, 2007 - 22:17
Project:Javascript Tools
Version:5.x-0.6
Component:Tabs
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

I have been reading on the page http://www.stilbuero.de/2006/11/05/tabs-version-2/ about how to set up tabs. I feel incredible stupid. :)

I found this code in the readme. It works, but is this how you're supposed to use Tab from the Javascript Tool module? How can I add effects to this?

  $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']['tab3'] = array(
    '#type' => 'tabpage',
    '#title' => t('Three'),
    '#content' => t('Third tab content.'),
  );

  return tabs_render($form);

#1

lambert - March 21, 2007 - 04:14

Ditto.

Where does that code go, are there support files, what's supposed to happen, etc. etc.

#2

brady747 - March 26, 2007 - 22:40

Double ditto.

#3

lambert - March 27, 2007 - 03:00

I found the answer on this. Check the docs directory, which has tabsexample.module.text and tabsexample.info.txt.

Remove the .txt extensions, so Drupal can see them.

Enable the modules in the administration section.

See the _menu function in the example and go to the URL specified in the path item of the array.

A page with tabs should show up.

I'm not sure how enthusiastic I am about enabling tabs through a module, but it does work. Even better, it's the only solution I've been able to find to get more than one tabset on a single page -- I haven't been able to coerce the Drupal menuing system into doing this, though maybe there's a trick I'm missing.

#4

brady747 - March 28, 2007 - 05:35

Thanks lambert. Maybe I (or the others above me) wasn't clear. I've got tabs working per the code in the first post (same as your post explains I believe). But if you go to the link it has all kinds of 'effects' for the tabs. I (and I think the others above me) are trying to learn how to implement these functions example: $('#container').tabs({ fxSlide: true });

thanks.
brady

#5

brady747 - March 30, 2007 - 13:15

Well...somehow in trying to add the effects from: http://www.stilbuero.de/jquery/tabs/ I managed to change something and now I can't even get my basic php code:

<?php
$tabs
= array();
$viewargs = array();
$tabs[] = array(
  
'#title' => t('Specifications'),
  
'#content' => t('Some specifications go here.')
);
$tabs[] = array(
  
'#title' => t('Reviews'),
  
'#content' => views_build_view('embed', views_get_view('recentblogposts'), $viewargs, true, 3)
);

return
theme('tabs_tabset', $tabs);
?>

to show any tabs at all. Its pretty frustrating to spend hours just trying to get back to where you were. Anyhow, If anyone can at least verify for me (us) that there is a way to add effects from the link I just referenced above - for example: $('#container').tabs({ fxSlide: true }); - to jstools tabs that would at least mean I know Im not wasting my time trying to get it to work. Thanks.

#6

brady747 - March 30, 2007 - 13:56

Sorry to keep posting. I went back to the 'tabs' files in the 5.x-0.3 release as I found the problems others were having here: http://drupal.org/node/129216 . For some reason that has brought my php code tabs back. I'd still love to hear any info regarding the effects above.

thanks.
brady

#7

nedjo - March 30, 2007 - 14:23

The code needed to generate tabs changed between versions. See the current dev release's readme file, http://cvs.drupal.org/viewcvs/drupal/contributions/modules/jstools/tabs/..., or look in CVS for the /docs directory, where there is a sample implementation.

#8

brady747 - March 30, 2007 - 14:57

Thanks very much. Sorry to not have looked there (which should have been obvious), I was to excited to just get my tabs back.

#9

brady747 - March 30, 2007 - 15:59

Yeah. I think I have the answer to the original posters query (if I understood it correctly...). I added

<script type="text/javascript">

  $(document).ready(function(){
$('#container').tabs(2);

</script>

above the php and I got the effect from Klaus' demo page. Thanks to all who work hard on this. Sorry for all my posts here, but hopefully this helps the orginal poster (it certainly solves my question).

#10

nedjo - March 30, 2007 - 16:09

IIRC Klaus mentioned in an email he's planning to add support for a feature request to specify an active tab by giving it the selected class in the HTML. If that is indeed added to the tabs library, it will be simple to support it in tabs.module.

#11

lambert - April 1, 2007 - 16:56

Would this help solve my problem of two tabsets on one page, where a selector swaps one of the two tabsets in and out?

#12

j.q - April 10, 2007 - 07:03

Following up with the first post: how do we load content into the tabs? I've gotten the page with tabs, but now I need to load data from previously created nodes? Any ideas?

#13

Wim Leers - January 21, 2008 - 23:15
Status:active» closed

No reply in more than 6 months - closing.

 
 

Drupal is a registered trademark of Dries Buytaert.