Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

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
add comment

2 Answers 2

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 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 at 12:05
add comment

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
add comment

Your Answer

 
discard

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.