Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Saied 349 posts 674 karma points
    Nov 13, 2015 @ 14:46
    Saied
    0

    Render a list of pages based on the number of clicks?

    Hi,

    I have an FAQ section which lists questions. I want to order the questions by the number of clicks, so the questions that have the most clicks should appear at the top. Is it possible to handle this somehow?

    Thanks Saied

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    Nov 14, 2015 @ 23:32
    Alex Skrypnyk
    0

    Hi Saied,

    Where are you storing clicks amount ?

    Thanks, Alex

  • Nicholas Westby 2005 posts 6843 karma points c-trib
    Nov 15, 2015 @ 04:46
    Nicholas Westby
    0

    When a user clicks a question, send an AJAX request to the server (to a controller/action method you setup). There should be some way of identifying each question other than order (e.g., give each a unique ID). If your questions are stored as nodes, you can use the node ID's.

    Once sent to the server, you can store the clicks in whatever way makes sense for you. You could store them with each question, or you could store them in a database table. You may also want to store the IP address of the visitor (e.g., so users can't game the system and click a single question a bunch of times).

    Then, when rendering the FAQ page, sort the questions by number of clicks.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies