5

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.

2 Answers 2

6
  • 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.
2
  • Thanks Anil ! I am trying your solution . will let you know if it works .. Commented Mar 28, 2014 at 7:22
  • Anil i need one more favor, how can i render these tabs in my views template file . Thanks Commented Mar 28, 2014 at 12:05
5

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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