Correct code to include tabs in tpl.php

ivalea - September 24, 2007 - 15:35
Project:CCK Fieldgroup Tabs
Version:5.x-1.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

Hi - first, love the module - exactly what I needed, thanks! :)

The one problem I'm having though is that I decided to create a separate template for the content type that uses the tabs. The name of this file is nod-plans-tpl.php. When I didn't find the print command easily to print the tabs I ended up hardcoding the unordered list menu inside this file. So now my code for the plans reads:

<div class="drupal-tabs">
<ul id="planspg">
<li><a href="#tabset-1">Floor Plans</a></li><li><li><a href="#tabset-2">Model A</a></li><li><a href="#tabset-3">Model B</a></li><li><a href="#tabset-4">Model C</a></li><li><a href="#tabset-5">Model D</a></li></ul>

Though the page works perfectly and I like that I was able to give the list their own id for customizing the look I now notice that I lost the ability to disable tabs if their is no content in that section. If you look at the list items in the code above you'll notice that I have tabs for Models A through D. The content in these sections only contain one image.

I guess my question is what is the correct code to include the tabs in a tpl.php page so that the tabs without content disappear? Or is there an if statement that I can include in the li tag that would give a class of "tabs-disabled" if the image for the each model doesn't exist?

So far I've tried the following code but unfortunately it either gives me a parse error, disables the tab even when the corresponding content DOES exist or it does nothing.

<li class="<?php if (content_format('field_model_a_img', $field_model_a_img[0]) == '0') { echo "tabs-disabled"; }else{ echo "none"; } ?>"><a href="#tabset-2">Model A</a></li>

Any help on this is appreciated! Thanks!

#1

eggthing - April 9, 2008 - 19:41

Yes, I second this request. Would love to be able to use a node.tpl.php to customise bio and use cck fieldgroup tabs too.

#2

eggthing - May 30, 2008 - 13:42

Any news on this?

#3

mattez - August 7, 2008 - 09:39

+1

 
 

Drupal is a registered trademark of Dries Buytaert.