Done in 60 seconds: View-driven Slidebox

×

Error message

  • Deprecated function: The each() function is deprecated. This message will be suppressed on further calls in _menu_load_objects() (line 569 of /home/flinkco/public_html/includes/menu.inc).
  • Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in drupal_get_feeds() (line 394 of /home/flinkco/public_html/includes/common.inc).

We came across the lovely little Slidebox module for the first time via Jeff Eaton's Monday Module blog. We loved it and installed it on flink. If you're not sure what we're talking about just scroll to the bottom of this page and pay attention to the bottom right. Slidebox is clever, lean and simple in its design. It works well and takes about 10 seconds to get up and running, especially if you install with Drush. All you need to configure are the content types you want it to do its thing for, and you're away.

And therein lies the rub.

Because for Slidebox to be truly versatile more refined selection criteria would be ideal. In particular you'd want to control:
1) on what content the slidebox may appear on, and
2) what page it recommends the visitor to view next (i.e. "Next post")

Slidebox always picks the most recent node of the same type that was created just before the one currently showing. This was not configurable. Until now.

So here we go with 50 seconds remaining. Clock's ticking.

  • Download and uncompress to your sites/all/modules directory the Slidebox module (7.x-2.x version). No need to configure anything.
  • Create a Content view, say "Slidebox content". Configure it to output the nodes (just the titles is sufficient) that you'd like a slidebox to appear on. Use filters (e.g. taxonomy terms), if you wish. Sorting is also relevant: the "Read more" suggestion in the slidebox is the one that in the view comes immediately after the one showing. Order alphabetically or by modification date, restrict the view to the "5 best of".... go wild.
  • Next download and enable the Views Global Filter module. This module will pump your view into Slidebox. On the Global Filter configuration page, open the "Advanced configuration" fieldset. Select the view you just created.
  • Press the first radio-button (i.e. let the API cycle the filter) and "Save configuration".

Done -- sit back and relax. Visit a piece of content returned by your view, scroll to the bottom of the content and see the slidebox appear with its recommendation of the next related piece of content to read. Click "Read more..." etc...

Cute?

File under: 

Drupal 8: contrib roads, take me home

Read More »