0

I need to make a view of featured content. I'd like to make it so that two columns display: the left column with one item, and the right with 2 items. Essentially like this spot:

enter image description here

I've been trying with some different layouts, but for some reason this is escaping me. It can't be that hard, can it?

EDIT: I may not have been clear enough in my original post. The answers given so far seem to refer to formatting the fields in different positions, so that for each piece of content, field A would be on the left, and fields B and C on the right. That is not what I need.

What I need is instead of displaying three fields in this format, I need to display three pieces of content in this format. For this view, each image links to a different piece of content, so I'm only using a single field. I need to display the image for node A on the left, and images for nodes B and C on the right.

3
  • 1
    why you don't use two different view blocks then insert them in two regions? Jul 3, 2015 at 10:54
  • This doesn't make sense to have one result from a view be outputted like this. First off it's a view of popular shows, not featured. the featured show would be masterchef and its placed in that column based on having the most views for that day/week. If you are using featured content how are you suppose to swap out the big one anytime you want? Make multiple views and display them as blocks.have a checkbox for featured in the content type, left box displays the most recent featured one, right displays others. If you want what they are doing calculate # of views per content, filter accordingly.
    – DMAC
    Jul 3, 2015 at 16:35
  • I've seen people solve this issue with : drupal.org/project/views_column_class. But with one result it's hard to do anything with it. It's just smarter to separate views if you want control and flexibility.
    – DMAC
    Jul 3, 2015 at 16:37

5 Answers 5

1

If you are having panels module installed than the best would be to use the Panels fields as following:

  1. Set the display style in your View to show Panel Fields.
  2. Add the fields you want to show in your view.
  3. Configure the settings of Panel fields as:
    • Select Panel layout: Two column stacked
    • Assign fields to the respective section (e.g: top, right, left), as per your requirement.
  4. Save the view.

Check the attached screenshot for reference: enter image description here

enter image description here

3
  • That doesn't quite solve my problem. I considered this, but the issue is that I'm essentially displaying one field for each piece of content. I just need to have one piece of content display on the left, and two pieces of content on the right. If I needed this layout for each individual piece of content then your suggestion would be a great solution.
    – Mrweiner
    Oct 21, 2013 at 16:33
  • Sorry if I wasn't clear. I need to display a total of 3 pieces of content. I'm displaying one field, an image field, from each piece of content. I need to display the first image (piece of content) on the left, and the next two images (pieces of content) on the right.
    – Mrweiner
    Oct 21, 2013 at 17:07
  • @Mrweiner Ok, I am not wrong now than you want to display image from node A on left, and the other images from node B and Node C that will be on right, if that is the case than I guess you can do that with CSS as all the fields of views have unique class Oct 21, 2013 at 17:15
1

You could create 2 views; both with the same criteria, but the first one returns a single result, and the other one returns 4 results (or however many) in a grid, with an offset to skip the first result. Then just embed the views on a page using Panels.

1
  • I had the same use case a while ago and this is how I solved it. Feb 24, 2017 at 6:21
0

you can use views_fieldset module

Creates fieldsets in Views fields output, to group fields, by adding a new field: "Global: Fieldset" and a few preprocessors. Also introduces a new template: views-fieldsets-fieldset.tpl.php where you can customize your fieldset output.

Once you install it ,it will allow you to have a fieldset/div or better to say grouping of fields inside different divs and then simply use css to give allign them.

1
  • This seems to only group fields, right? I need to group my content in either column. So my view displays three results, with an image for each, and I need to have on image on the left and two on the right. If I'm not mistaken, views_fieldsets seems to not apply to my situation.
    – Mrweiner
    Oct 21, 2013 at 16:41
0

This can also be done in your tpl file. Say you format your view as a grid you would use a views-view-grid--your-view--your-display.tpl.php.

Then you would modify your copied default tpl for the rows. Putting something like this just in front of your foreach that prints out the rows should be pretty close:

$first = array_shift($rows);
<tr class="row-class">
  <td class="col-class">
    <?php print $first['your-field']; ?>
  </td>
</tr>

Untested and from memory but should get you really close.

0

Use CSS to resize the result nodes and float result node 1 to left and/or 2 and 3 to right. No modules, no server processing...

1
  • Hi @Causa, welcome to Drupal Answers. To improve your answers, please add the exact css code to do what OP asks for. If possible, also include a hook or theme function to add said css code. Thanks! Feb 24, 2017 at 7:43

Not the answer you're looking for? Browse other questions tagged or ask your own question.