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?
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.
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
Hi Saied,
Where are you storing clicks amount ?
Thanks, Alex
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.
is working on a reply...