I am having a bit of a problem with the Tabs Module it works fine in a Node with PHP as the Input format.

However, I am using the Drupal 5.X with the Zen theme and would like to use page.tpl.php to output the Primary Links Menu in tabbed format.

The README file for the tabs gave the following code:

    $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);

...which works fine in a Node with PHP as the Input format. However, I am using the latest Drupal with the Zen theme and would like to use page.tpl.php to output the Primary Links Menu in tabbed format.

page.tpl.php:

if (isset($primary_links)) :
foreach ($primary_links as $link):

// Would like to set out the tab code here... unless you know of a
better way

endforeach;
endif;

Basically, I would like to know the preferred way of doing this. I tried copying the first code segment to the page.tpl.php file but it seems to 'crash' the PHP engine and no output is made after the 'return tabs_render($form)' call...

Comments

nedjo’s picture

Try print instead of return.

mjs-1’s picture

Thanks - tried that

Print doesn't seem to work. It just echoes the text, and not javascript needed.

bcn’s picture

print seemed to work ok for me in my node-tpl.php file...

 $form = array();

  $form['example1'] = array(
    '#type' => 'tabset',
  );

// the rest of the code

print tabs_render($form);   

wim leers’s picture

Status: Active » Closed (fixed)