Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4231030
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T01:55:33+00:00 2026-05-21T01:55:33+00:00

I had an interesting request from a client today and I’m not exactly sure

  • 0

I had an interesting request from a client today and I’m not exactly sure the best way to solve it using Drupal Views. They currently have a “Team Member” content type that represents members of their staff. Each staff member page has a link to all other staff member pages. So far that’s not a problem.

They want this list to start with the person we’re presently looking at and then proceed with who falls right after them in the “sorted” order. Then when it reaches the end of the list it wraps around and starts back at the beginning until they get back to themselves (similar to how a Circular Linked List would work).

So for example, assume I have Team Members A,B,C,D,E,F and G:

  • If I’m looking at Team Member A, the list order is: A, B, C, D, E, F,
    G.
  • If I’m looking at Team Member D, the list order is: D, E, F, G, A, B,
    C.
  • If I’m looking at Team Member G, the list order is: G, A, B, C, D, E,
    F.

If I was dealing with some other data structure in a regular programming environment, I’m sure I could come up with some sort of algorithm to determine where we presently at and begin sorting from there and fake a “circular list”. Views seems a little more tricky.

The only potential solution I can think of would be to create two separate views and then just join the results together after the fact.

  1. One view would be a sorted list of all team members that have a sort number greater than or equal to the present team member.
  2. A second view that is a sorted list of all team members that have a sort number less than or equal to the present team member.

I’m just curious if there are any more efficient ways of doing this kind of a sort with views?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T01:55:34+00:00Added an answer on May 21, 2026 at 1:55 am

    As long as all your results can be contained on one page, you’re probably best off with the solution you mention: manipulating two views (probably in the template, as Oswald suggests) so one is displayed after the other. However, if you do end up having lots of results, and needing paging … you will probably need to do some fancy work in calculating the difference between sort numbers, and using this value in ORDER BY … all that requiring the difficult task of rewriting the main Views query.

    I tried this a few years ago and had enormous difficulties … Merlin of Chaos, the main Views developer, simply stated somewhere that Views really wasn’t meant to be for fancy programming, and that the way it handled queries wouldn’t allow for much manipulation … things would break. However, something has changed in the meantime … I remember seeing a new function in Views which seemed to be made for the purpose of rewriting the main query.

    Here is a tutorial on rewriting a views query: http://blog.raisedeyebrow.com/2010/04/rewrite-a-views-query/

    Do note: due to the many things that are going on in Views, you should create a lot of dummy entries to make sure nothing is broken – if you re-write the query, it will be much more susceptible to error.

    Actually, if you are acquainted with Drupal module building, for something like this it might just make more sense to build a custom module that allows you more control over the query and the display. This might actually be faster than a lot of experimentation and testing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We've had an interesting request from a client. They'd like their users to have
Had this interesting question being asked today and the arguments varied from Proxy to
Today at work I had an interesting discussion with one of my coworkers. He
I had this interesting discussion today with a colleague. We were debating two pieces
I just had an interesting exchange about using .Except versus .Any, and the performance
Had an interesting discussion with some colleagues about the best scheduling strategies for realtime
Had an interesting error today and couldn't find anything online about it so wondered
I have run into an interesting issue using PHP's date() function. Haven't had any
I had an interesting problem today. As part of practice with my fluency with
I just had an interesting experience with a startup form in MS Access 2010.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.