I have been trying to replace the node title in the slider tab with a cck image field which is attached to the node being displayed in the slider panels (a different icon for each slider panel). I tried using;

$node->field_icon[0]['view']
$vars['node']->field_icon
$vars['node']->field_icon[0]['view']

and a bunch of others variations but couldn't get it to work. I tried these variables in the slider.tpl.php and in slider.module but couldn't get anything to display. Could you please tell me what i am doing wrong or what is the correct way of replacing the node title with an image (which IS NOT set as a background property through CSS)?

Comments

joshua.howell’s picture

Any suggestions please???

joshua.howell’s picture

So i have been reading through the Themeing documentation and i think what i need to do is setup a variable in the template_preprocess_slider(&$vars) function to hold the datd for the image, is this correct?

I copied this function from slider.module and pasted it into my themes template.php file and renamed the function phptemplate_preprocess_slider but when i made change i ended up getting double output (two sets of tabs). Have i made a mistake here?

The field_icon field comes from a content type called Branch so i guess that would be why the variable wouldn't be available to the slider template, is this correct? Do i need to write a SQL query that links the current node to the appropriate Branch content type record to obtain the field_icon data?

Some feedback would be much appreciated.

kilrizzy’s picture

Would love to know how to do this as well

MULK’s picture

Okay... I try to do the same but a little bit more complicated: with a special field in the Slider Content Type. I created a radio-button field you can choose the type of Tabs with: none, title of the node, numeric and Tab title (tab title take a specific field. created in my "slide panel" content).

I did the same as you did and I have the same problem as you: Tabs appear two times. Then, I modified the original module function, and added:

echo "hello world!"

at the end of the function (just before the last "}").
The text "hello world!" appear in my site !!!
This mean the tabs are generated two times: one with the original function, the second with the modified function in tenmplate.php.
This mean the function has a problem with the overriding in the template.php file, I think...

(sorry for my awfull english :)

MULK’s picture

I found the problem!!!!!
in the original function, on the line #132, you have this

$vars['tabs'][] = array(
      'data' => l($slide_title, $link, $slide_options),
      'class' => 'tabtitle-' . $vars['node']->nid . '-' . $slide_node->nid,
    );

In my function (in template.php), I added $i in the empty key of the $vars['tabs'][] :

$vars['tabs'][$i] = array(
      'data' => l($slide_title, $link, $slide_options),
      'class' => 'tabtitle-' . $vars['node']->nid . '-' . $slide_node->nid,
    );

I'm not sure it's a good solution, but it work!

MULK’s picture

kilrizzy -> If you want to have the file I created, no problem for me. But I'm working on them, they aren't finished.

MULK’s picture