Welcome to WebmasterWorld Guest from 54.146.46.195

Forum Moderators: mack

Message Too Old, No Replies

Rotating static content categories

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

Junior Member

5+ Year Member

joined:Jan 14, 2007
posts:136
votes: 0


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 June 8, 2010 (gmt 0)

Senior Member

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

joined:Nov 28, 2004
posts:7999
votes: 0


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 June 9, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 12, 2003
posts:1199
votes: 0


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 June 9, 2010 (gmt 0)

Senior Member from US 

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

joined:Nov 29, 2005
posts:6964
votes: 385


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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Nov 3, 2005
posts:1585
votes: 0


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 June 9, 2010 (gmt 0)

Senior Member

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

joined:Nov 28, 2004
posts:7999
votes: 0


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 June 11, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 12, 2003
posts:1199
votes: 0


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 June 23, 2010 (gmt 0)

Junior Member

5+ Year Member

joined:Jan 14, 2007
posts:136
votes: 0


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.