0

Is there a way for a view to pull out x number of nodes of the same content type but use a different theme function for each one depending based on the value of one of its fields?

I need each node to be themed according to a field which will have the name of a theme function.

1

Display Suite Extras, shipped with Display Suite, lets you choose a different build mode for every row in the View. You might look its code to see how it's done and then hook into it to switch based on the value of a node field. Shouldn't be hard.

0

I gotta ask, why use Views?

This can easily be acheived in a block or menu callback using a simple db_select() and then you can iterate over the results yourself and apply your theme functions as you see fit.

Alternatively, if you are too lazy to write the query yourself, create the view and use views_get_view_result() to get the values and iterate over them yourself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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