views:

30

answers:

1

I have a view, which outputs all different types of nodes. One content type which I created is called "photo" and includes a CCK Image field.

I want to customise the output, Im currently using views_customcode module to write PHP but I cant find the data to output the CCK image field?

Ive also tried theming the view output, but, I want to combine the Photo content type with another content type into the same div in order to output it a specific way so I dont think theming will work here

any suggestions?

+2  A: 

You can use Views theming for this: any output handling should be done in the theme layer. To combine two fields, create a theme template for the second field. So, if you have two fields, field_text and field_picture, and field_picture is after field_text in the fields list in the view, create a template for field_picture. You have to do this because the field can't reference fields that get loaded after it.

In the theme template for the second field (e.g. field_picture), the theme template starts out with $output. To get the output of the first field, use:

$output_first_field = $row->{$view->field['field_text']->field_alias}

Where field_text is the name of the first field. Now that you have both outputs, you can combine them right in the field's template.

If you don't want the first field to show up by itself (now that it's been combined with the second field), edit the settings for the first field and check Exclude from display.

You can use the Theme information section of the view to get the file name, the initial template, and the field names.

Mark Trapp