I'm at a bit of a loss on how I should go about creating a views page display which requires some fields to be displayed unformatted and others which need to be shown as a grid. Is there any way to do something like this?

More precisely what I currently have is a view which displays the node title & body with the style unformatted and sandwiched in between the two fields I need to have a grid output of a image cck. Does anyone know how or if its possible to do?

Comments

Anonymous’s picture

In your view, you would output fields rather than nodes. For example, we'll call them title, images, body. Look at the source for the output of the view, and find the images. You'll see that they are wrapped in css classes, so you can float the images left, add borders, padding etc, and essentially produce a grid output sandwiched between the title and body fields.

If you actually need the images to be inside of an html table then you can, when in the views UI, click on 'Advanced' and then at the bottom of the column click on Theme: Information. You'll see a list of template suggestions. You'll have to experiment a bit to see which one works, but I'd bet that it's the row style. You create a new .tpl.php file using the most specific name suggestion, then copy the suggested template code into it and start modifying it.

If you have the devel module installed, you can use the call dsm($fields) to output the array to the screen. This will give you a good idea of the stuff you have to work with. Once you know that, you'd use php foreach to cycle through the image field and wrap each image in the html for a table.

jaron’s picture

I was wondering if you could give any further instruction. Though I understand how to create the new .tpl.php file and I think I understand the css involved, it seems like it would be hard coding a lengthy table. Is there a way to make the .tpl.php look for the data being delivered and use it as a basis to create the table? I assume there must be a way have the .tpl.php create a table based on the number of nodes in the view and fill it with the images, but I don't know enough php to know how to do it. Any help would be appreciated.

Thanks,
Jaron