I have a content type created with CCK and a node-*type*.tpl for the node display. I've created a view that is meant to display search results and a node teaser.
I've done this on another site using a different theme(Omega theme) and it worked for me but it's not working with the boldy theme.

This is what I used before: http://drupal.org/node/53464 and assumed it would work again... do I perhaps need to add any aditional code for this to work with my CCK field values to display?

if ($teaser):

2 print $node->field_main_image[0]['view']
3 print '<a href="?q=email/' . $node->nid . '/field_email">' . '<img src="sites/all/themes/boldy/images/request-quote-teaser.png">' . '</a>';
4 print $node->field_about[0]['view']
5 print $node->field_book_now[0]['view'] | print $node->field_website_url[0]['view'] | print $nid " title="Click Here for listing details">View Details
6 print $node->field_min_rate[0]['view']

else:

Then the rest of my node content...
endif;

The only values that the teaser displays are 1 - the title and 3 - the email and 5 - but only the 'View Details' part.... any other field values are not displayed.

Can anyone shed some light on my issue?

Thanks

Comments

the_g_bomb’s picture

If you add the following code to your tpl file
echo "<pre>"; print_r($node); echo "</pre>";
That will show you all the variables contained in your $node object and what the property name is that you need to use to output the content. Check in that output that your fields are named as you expect. It could be that your CCK image field is not exactly called "field_main_image" for example.

nravens’s picture

I've used the values that I got from content template... I think the code you mentioned displays what I get from content template.. also the "field_main_image" value and all the others that I used corresponds with what I used when I created the content type.

To display the above search results as a Teaser, the view that I created has the "Row Style: Node" set to display the teaser...

I'm changing the Row Style to Fields and displaying the fields I want and then gonna style it will CSS.. I'll see how that works...

But still a bit confused about why the Row Style: Node doesn't display the teaser... if I set it in the view to display Full Node then it displays the full node...

the_g_bomb’s picture

What settings have you set in the Display settings for the content type?
check that under admin/content/node-type/[your-content-type]/display

the_g_bomb’s picture

Category: bug » support
Priority: Major » Normal

Another question, if you change the theme to one of the base themes, such as Garland, and add your .tpl file to it, does the code work there?

nravens’s picture

I have the fields for the teaser that I want to display unticked... the rest are excluded... but as you suggested, I've tried the Garland theme and have the same problem so it's not related to Boldy theme then.... Something else is causing the issue because I don't even get teaser fields if I use the Garland theme even without my custom node-'type'.tpl

In my view that I have to display the teaser with 'Row style' set to node and build mode set to 'Full node' it shows the full node but set to teaser shows only title and taxo values...

I have no idea what could be causing this...

the_g_bomb’s picture

Status: Active » Closed (works as designed)

When you add and remove the custom tpl file are you remembering to clear caches as the tpl could still be loaded if you don't.

Failing that I have found this issue: http://drupal.org/node/1325706 that links to a number of similar issues, where CCK fields are not appearing in the teaser build mode.

Between them all, they list a number of situations and possible fixes.

Lastly for my suggestions would be to look at Display suite to handle the field output: http://drupal.org/project/ds it would replace the need for a custom tpl or contemplate altogether and would give you more granular control all round.