Welcome to WebmasterWorld Guest from 54.163.115.193

Forum Moderators: brotherhood of lan & mack

Rotating static content categories

   
10:34 pm on Jun 6, 2010 (gmt 0)

5+ Year Member



I have a static one-page website with six (6) categories of data. I want to rotate the categories (and their content) when they are displayed. By rotation, I mean the display order of all the categories: All six (6) categories, and detail, will display on each page view. I want them all to be visible, but in a different order each defined interval. The display rotation interval can be flexible: weekly, daily, hourly, per unique visitor or per “x” number of clicks. (The purpose is to provide each category equitable “above the fold” views and viewer interaction opportunity). Is there a way to do this while keeping the content static? How to do this?
4:40 pm on Jun 8, 2010 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



There are only two ways I can think of.

You can use mod_rewrite to redirect all requests for a given page to a script that randomizes which page to display. To avoid the URL changing in the address bar, don't print a location header, get the file contents and print it out to the browser.

The other way is not **exactly** random, it's based on time, but it will "act" random, and also used mod_rewrite directives. jdMorgan proposes a starter idea in this thread [webmasterworld.com].
5:40 am on Jun 9, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Those ways work, but they seem a bit cumbersome to me. I would do it with JavaScript. That way you don't have to screw around with multiple files, and all the code you need is on the same page.

Before someone starts screaming that JS shouldn't be used because not everyone has it, I don't think the OP will care if <0.01% of his/her visitors get the regular order rather than the random order of the (presumably) ads.

Here's how I'd do it:

<div id=cat1>[content 1 goes here]</div> 
<div id=cat2>[content 2 goes here]</div>
<div id=cat3>[content 3 goes here]</div>
<div id=cat4>[content 4 goes here]</div>
<div id=cat5>[content 5 goes here]</div>
<div id=cat6>[content 6 goes here]</div>

<script type=text/javascript>
for (counter=1; counter<=6; counter++) {
content[counter] = document.getElementById('cat'+counter).innerHTML;
}

catsToPickFrom = [0,1,2,3,4,5,6];
for (counter =1; counter<=6; counter++) {
pickedCat = Math.floor(Math.random()*(catsToPickFrom.length-1))+1;
document.getElementById('cat'+counter).innerHTML = content[catsToPickFrom[pickedCat]];
catsToPickFrom.splice(pickedCat,1);
}
</script>
6:04 am on Jun 9, 2010 (gmt 0)

WebmasterWorld Senior Member tangor is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



This can also be done with server side includes (SSI), which bypasses any JS concerns.
2:04 pm on Jun 9, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



It is probably not a good idea to feed the the search engine with content it different order each time, so use javascript.

Before doing anything consider how users get to and use the page.

Repeat users may be confused.

Do the categories match well with search terms, eg 'pink widget' search and 'pink widget' category.

Is it good for 'pink widget' searcher to see only random color mentioned above the fold.
3:46 pm on Jun 9, 2010 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



JS shouldn't be used because not everyone has it,


That's not why you avoid Javascript dependence. You avoid dependence because some devices will get different content than those with it. Search engines, some handhelds, for example. Anything you do in JS you'd do server side as well to insure distribution of the same content anyway.

feed the the search engine with content it different order each time


Right, wondered about this but figured the O.P. had their reasons. Maybe it's like a daily [something-or-other] site. :-) But you'd still want to look it up later.
7:00 am on Jun 11, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That's not why you avoid Javascript dependence. You avoid dependence because some devices will get different content than those with it. Search engines, some handhelds, for example.


If the OP doesn't care about that, then it doesn't matter. Which was my point.
1:23 am on Jun 23, 2010 (gmt 0)

5+ Year Member



To all:
Thank you for the replies, and the spirited dialogues. Please excuse my absence for a week, due to extended family health issues (104 years old!, and still going!). It seems that the javascript solution may be most practical, and I am working to get that solution working. Re the viability / practicality of content rotation: Overall, there is a disproportionate amount "above the fold" clicks. This is an attempt to: 1)Validate (again) the value of "above the fold" page position"; ;and, 2)Establish a baseline for establishing that content may be less critical than position.
 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month