2

I have a view like this:

  • Field A (Inline)
  • Field B (Inline)
  • Field C (Inline)
  • Field D

I would like it to display like this:

  • Field A label: value Field B label: value
  • Field C label: value
  • Field D

Obviously, I need to create a break after the value for Field B. However, what is the best way to do this? CSS in my stylesheet? Rewrite the HTML for the display of Field B? Add a "Custom text" field within the view? It seems like there must be a simpler way...

I hardly ever work with themes so I'm at a loss of how to best address even this basic formatting issue.

EDIT: I've realized that a solution that makes the view label inline but not the whole field would also work, but I don't know how to do this...

4
  • Your ideas seem all very sound to me. You can clear:right field B's wrapper, you can put a <br /> in a Custom Text. What stops you from implementing one of these ?
    – Countzero
    Mar 23, 2012 at 8:14
  • Nothing is stopping me from implementing one of these. I was just wondering what is the cleanest, most easily maintainable way to do this. For example, I didn't even know "custom text" existed until yesterday, so I figured I would ask to see if there was a way that was better than what I already knew. Mar 23, 2012 at 8:18
  • As much as possible, I stick to CSS. If I cannot achieve what I want, I try to rewrite the fields via UI. If it's not enough, I go for the template files to customize further. This way of thinking is pretty common and I think you'll be safe adopting it.
    – Countzero
    Mar 23, 2012 at 8:24

2 Answers 2

1

You can create a custom layout with Panels module then use that layout inside your view by choosing Panel Fields as rows style and assigning your fields to different regions of the layout.

2
  • This is quite an interesting solution that I hadn't thought of. Thanks! Mar 24, 2012 at 14:47
  • This is also very useful when you work with Features module and you want your views look the same everywhere.
    – kamyar
    Mar 24, 2012 at 23:33
1

I would say CSS is the better route because it separates your content from your layout just as CSS does with respect to HTML. Also, if you decide to change your layout later on, CSS will most probably be easier (and more obvious) to change than some fake data in a view forcing that is forcing/hardcoding your layout.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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