views:

1023

answers:

2

I am creating a gallery/albums site in Drupal 6. Perhaps the description will be a bit detailed, but still on some reason it's a problem to create a gallery in Drupal in a simple way.

As for now I am using CCK + Views + FileField + ImageCache + Lightbox2 combination.

This has allowed me to - create Album CCK node type that can hold multiple images - create a view that displays Albums in 9x9 fashion (using pager and items per row)

But here is one problem. While the main 9x9 view with albums displays nicely, when I drill down into particular Album node by clicking it's picture, it displays the uploaded node images in a vertical row and I am unable to control it's formatting.

Apparently, I have 2 options a) to somehow control the html output of my CCK field with its files (to divide into rows) b) or to create another view to display pictures from one album

As for now, I am not sure which of these two ways is the best and what specifically I need to do.

a) I can create node-album.tpl file - but all its content will already be in a single $content variable, which I don't be able to break into 3 items in a row. Am I wrong?

b) if I decide to create a view to display items from a single Album node, I am not sure how I reference it from the parent Albums view. The problem is that in view's Fields section I am able to override the Link, but it offers only 2 replacement patterns to pass to a potential "child" view, which are [title] and [field_images_fid] - is that enough to create a child view to show images from a specific album?

+1  A: 

I just recorded a screencast outlining one approach. There's quite a bit of discussion in the comment threads about alternative methods; I'd definitely suggest using Views Attach if you want more control over the presentation of the gallery itself.

Eaton
A: 

I can create node-album.tpl file - but all its content will already be in a single $content variable, which I don't be able to break into 3 items in a row. Am I wrong?

You are right and wrong.

In your template.php file you can pass other variables into your node-album.tpl, you could pass in the $node variable and display in a very customised way, although this will remove flexibility later on, as if you use another module to add things to $content you will have to edit the tpl file to access new variables.

To do this you use the preprocess_page hook in the template.php file. You can add variables to the $vars array and use these in the node-album.tpl file. I think that $node will already be defined in the tpl file, which will probably make your life easier. you can disregard content altogether.

If this doesn’t work for you, you can also create a custom module and use hook_nodeapi and hook_theme to theme things any way you like, while still using $content. However this may be a bit too much work for you needs (if you want to go this way, reply and I'll write a separate answer).

Jeremy French

related questions