views:

35

answers:

2

I'm in need of some pointing in the right direction here...

I have a site with a couple of different content types. I want to display this content in a book-like layout. The book should be of a fixed width and height and the pages should be populated with as many nodes as can fit. It should be in two columns, with the left column being filled before the right one.

How should i approach this?

I have been thinking about a few solutions, don't know which are possible and which one is best or which i can combine.

  1. I could just create a view that selects more nodes than is need. Then check how long the nodes is in the theming layer and throw away the nodes that aren't needed. Pagers need to be fixed too.

  2. Use panels in combination with views to display one view in two columns, if this is possible. Need a way to determine the amount of nodes that is displayed on each page, based on content length.

  3. Write a plugin/handler for views so that i can select an amount of nodes that has an maximum, predetermined, max content length.

  4. Write a new display-style for views that shows content in two columns with fixed heights.

  5. Write a custom module, leave views and panels out of it and do everything myself with db_queries.

Would appreciate and guidance a lot. Not looking for a finished solution, i'm not afraid to code and i will contribute back if i create something that someone else can use (like a views plugin). Just need someone to guide me in the right direction :)

A: 

Drupal help you build fast, and it looks like promising but fails to fullfil the needs of client, designer also programmer. You need to write one module page, and some functions.

5th solution you gave has little trouble than others. Write a function that to have "teaser like" behavior, I will return formatted node according to its type. Don't lay on drupal's teaser system. If teasers will have different heights, add height to teaser function.

nerkn
I don't want to crop down the nodes in any way. I want to display the full content. It is leaning towards a completely custom module right now, though...
Nasso
A: 

The hardest thing will be to figure out how much content you need to fill out the space. There's not really a good way to do that either since, it will depend on both the markup and the styles.

The best solution I can think of is loading the nodes with javascript, or maybe just have them available as javascript variables. That way you could insert the nodes to your page one by one. You could then in the JS see the heights of all the nodes in total, and once that height is bigger than x, you only need to remove the last inserted node.

It's not a perfect solution, but I think you should look at doing this with JavaScript. The only problem is, that it wont degrade gracefully very well.

googletorp
Haven't thought about doing it with JavaScript. Will definitely think about it. If i'm able to get the height of a div that contains the node it solves a lot of the issue with choosing how many nodes to output. Could also manipulate the pagers with javascript. I could start out with a view with 5 nodes on each page of the book and then move nodes from the first to the second page and remove nodes from the second page as needed. If javascript is disabled, the user would get an strangely dimensioned book, but thats not the end of the world. Thanks!
Nasso

related questions