1

Does anyone have an idea how i might display a slideshow with alternating data (odd even style) of content type?

Currently the view is loading the fields, and i guess it could be one step closer to load the rendered node, but how can one alternate it, and limit it?

So like : Slide 1: Article Slide 2: blog Slide 3: Article Slide 4: blog etc..

  • Bit of a mad idea that might work without having to mess with custom templates. Get the views_php module. Create a view and choose rendered entity/rendered content field for each type of alternating content you want and choose to exclude them (make sure they have view modes unique to that specific content type). Use a views php field to show one of the above fields based on whether its an odd or even from the available views data. Not adding as an answer as I have no idea if it would work! – 7wonders Feb 23 '13 at 14:39
0

In broad strokes, you could use Views' views_pre_render() hook to reorder the result of the View, eg...

function YOURMODULE_views_pre_render(&$view) {

   switch ($view->name) {

      case 'NAME_OF_YOUR_SLIDESHOW_VIEW':

        // to figure out what you have to work with, take out when done debugging
        drupal_set_message('<pre>' . print_r($view->result, TRUE) . '</pre>');  

        // and here are the broad strokes... cycle through $view->result and
        // grab all the "rows" and re-order them by whatever business logic
        // you need, in this case even or them by content type instead of whatever
        // logic it is sorted in originally.  it you then set $view->result to this
        // new order, it will then be rendered by the Slideshow in that order

        break;

      // other Views might go here

   }

   // other code might go here, too...

}

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.