Quantcast
Channel: Recent posts across whole site
Viewing all articles
Browse latest Browse all 49206

Use Javascript (no ajax) for Views sorting - Have random sorting on cached pages

$
0
0

We have some hacked up tpl files to accomplish this goal, but I'm looking to create a module where one can select "Global: Javascript Random" as an option. We want to use this elsewhere so a views plugin sounds like the right thing to do.

Why? Lets say this view is used to rotate an ad on your site. If that is cached then the same ad shows until the cache is cleared. AJAX loading does work but for something as simple as this, it puts extra load on the server & slows down rendering time.

How? Lets say for the view it will display 3 nodes; with this plugin it will load 20 nodes (number configurable) and then client side it will use Javascript's Math.random() to select what 3 nodes to display. Inside a noscript tag it will have 3 random nodes, but these will not change until the page is created again.

Has anyone already created a module for this?


Viewing all articles
Browse latest Browse all 49206

Trending Articles