technicka.netfrom the cerebrum of Becky Gessler

Nodequeue for arbitrarily ordering nodes

On a previous project, I ran into complications with a left hand navigation menu. I wanted to give the content editor the ability to change the order of the items in the menu. I had heard of the Nodequeue module and knew it was essentially supposed to do this exact thing, but I was running out of time and my implementation would’ve had to make use of Smartqueues (an automatization of Nodequeues) and perhaps some added functionality… so I left it alone.

Fast forward a few months and here I am again with a similar issue, only this time, using Nodequeue. What a difference…. And this is actually really easy to do. I’m going to show you my implementation so you get a handle of how cool and powerful this can be.

Project

I have a content type “Staff” that I want to be spit out in a view on a page. Each Staff node has a different position (identified in a custom text CCK field), i.e. “Director”, “Intern”, “Coffee Maker”, etc. The Staff nodes should be organized on the page according to position, in rank order.

Nodequeue Saves the Day

With Views, I won’t be able to rearrange Staff nodes to my liking. Sure, I can sort by Post Date, and post Staff in rank order, but then what happens when a new Director comes and she is now the last node to be added? Nodequeue will allow me to sort my list of nodes as I want- using simple Drag n’ drop!

Implementation

Enable Nodequeue. Add a new Nodequeue under content management. Play with the settings to fit your purpose… changing the queue size will make Nodequeue automatically get rid of old nodes when you add more than the limit. Select the type of node you want to use with the queue (in my instance “Staff”).

Nodequeue Tab

You will now have a tab “Nodequeue” (unless you renamed it under Nodequeue settings) on each node of the content types you’ve selected for your queue. When you go here, you can add the node to the queue (or remove if it’s already there). Do this for as many nodes as you want. Note that you can also add and remove nodes from your queue by using the interface you see in the next image.

To rearrange the nodes in a queue, go to Nodequeue and then “list” and your particular queue. You will notice sweet drag and drop icons for you to arrange nodes exactly how you want. It’s a no brainer.

Drag n Drop

Now to get this Nodequeue really working, head over to Views, and you’ll see that you already have a view that was automatically created for your queue. It is sorted by Nodequeue- meaning you can take care of all your ordering from the simple Nodequeue interface and let Views just worry about outputting the nodes. Use node or fields style and configure away.

Nodequeue in Views interface

So basically we have a View that uses a dead simple interface to sort the order of its nodes, made possible by Nodequeue. Nodequeue can definitely do way more than this, which is what I still have to explore.

Here are some helpful links:

Filed Under

I pwn

Oh hai, my name is Becky and this is my personal website about tech and sometimes my life. I also make websites. You can learn more about that on my business website, Webfluence Consulting.