Drupal Answers is a question and answer site for Drupal developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have view which contains all nodes of a content type(article). default sort criteria of view is recent nodes. But i have three links Most Viewed, Most Favorited, Latest.I have to sort this view by clicking on these links .

I am making a node favorite by using flag module .

How can i achieve that .

Please Help.

share|improve this question
up vote 4 down vote accepted
  • Create three different views, Most Viewed, Latest, Most favourite with display type block.
  • For sorting by views, You need to enable statistics module.
  • For sorting by latest, use post date sort filter in views.
  • For sorting by favourite, flag module has integration with views. You can able to create a filter to sort by number of flags.
  • Use Quick Tabs module to group above three different view blocks as a single block and display it where ever needed.
share|improve this answer
Thanks Anil ! I am trying your solution . will let you know if it works .. – Yatendra Singh Mar 28 '14 at 7:22
Anil i need one more favor, how can i render these tabs in my views template file . Thanks – Yatendra Singh Mar 28 '14 at 12:05

You can achieve it using VIEWS.

First of all enable statistics module and create 3 blocks Most Viewed, Most Favorited, Latest and Add required fields

enter image description here

  • Views : Latest Block

    • Sort by POST DATE
    • enter image description here
  • Views : Most Viewed Block

    • Enable statistics module and go to admin/config/system/statistics configuration page and check Count content views

      enter image description here

    • Add the statistics counter field in VIEWS BLOCK if you want to see the count

      enter image description here

    • Add Add filter criteria to sort the VIEWS block to sort based on most Viewed

      enter image description here

  • Views : Most Favorited Block

    • Add the relationship

      enter image description here

      enter image description here

      enter image description here

    • Add filter criteria to sort based on flags

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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