homepage Welcome to WebmasterWorld Guest from 54.227.11.45
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / WebmasterWorld / New To Web Development
Forum Library, Charter, Moderators: brotherhood of lan & mack

New To Web Development Forum

    
Rotating static content categories
bw100




msg:4147856
 10:34 pm on Jun 6, 2010 (gmt 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?

 

rocknbil




msg:4148943
 4:40 pm on Jun 8, 2010 (gmt 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].

MichaelBluejay




msg:4149384
 5:40 am on Jun 9, 2010 (gmt 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>

tangor




msg:4149396
 6:04 am on Jun 9, 2010 (gmt 0)

This can also be done with server side includes (SSI), which bypasses any JS concerns.

daveVk




msg:4149654
 2:04 pm on Jun 9, 2010 (gmt 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.

rocknbil




msg:4149754
 3:46 pm on Jun 9, 2010 (gmt 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.

MichaelBluejay




msg:4151034
 7:00 am on Jun 11, 2010 (gmt 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.

bw100




msg:4157286
 1:23 am on Jun 23, 2010 (gmt 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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / WebmasterWorld / New To Web Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved