Click to See Complete Forum and Search --> : Rotating content includes on html page


Girlinprogress
08-22-2003, 01:42 PM
I am looking for a script or something that will rotate an include with html info on a page.
I have serveral "featured" businesses that I would like to rotate in the "featured" section of the html page.
I have created the includes, but I need to find a script that will rotate the diff. includes everytime the page is refreshed or re-visited.
Any ideas?

Thanks.

Exuro
08-22-2003, 02:28 PM
What are you using for the includes? ASP, SSI, PHP, JS, or something else? The script you're going to need will depend on the language... Also, how would you want it to rotate? Just random? Or a different include depending on the day of the week? Or some other way?

Girlinprogress
08-22-2003, 02:38 PM
These pages are just straight up HTML pages.
I am having to work within the contraints of an old site architecture as well as a pre-historic language - Web DNA - ?????
The include code looks like this -

Example: [include file=pages/homeNF2.tpl]
Or it could have an html extention.

A JS would work though.

Here is a link:
http://www.ilovevegas.com/headerNF2.tpl?whichPage=clickThru2NFX.tpl&goto=golf/index.html&sessionID=[sessionID]&whichSect=Golf&whichMenu=menuSports.tpl

The space I would like to rotate is the "Featured Golf Course"
Just that section.

I would want to rotate each property a specific number of times a day.... so they get a certain number of impressions a day.

Exuro
08-23-2003, 10:19 PM
Sorry, but I don't really have any experience with Web DNA. Whatever you're going to do, it probably won't be done with JavaScript since the includes are server-side. I'd try posting your question again on the General discussion board.

An idea for your rotation... Maybe, if it's even possible with this "Web DNA" you're talking about, you could have the page displayed based on the "minutes past the hour" part of the time. If the time is 01-10 minutes past the hour, then it displays a certain page, 11-20, 21-30 ... 50-00. You get the picture. Well, good luck! Sorry I wasn't of much help...

Girlinprogress
08-26-2003, 10:18 AM
We use a ton of java applets on our site, include one that runs rotating banners. Why wouldn't an aplet work to rotatate content? Also, this Web DNA software is also server side based.

AdamBrill
08-26-2003, 10:57 AM
Originally posted by Girlinprogress
We use a ton of java applets on our site, include one that runs rotating banners. Why wouldn't an aplet work to rotatate content? Also, this Web DNA software is also server side based. An applet would work fine. However, you are on a JavaScript forums, not a Java forums. ;) The only thing that is close between the two is the name... :D

Anyway, you could do that with any server-side language. I'm not familiar with Web DNA, but I'm sure you could do it with that, too... I could show you how to do it with PHP, but that wouldn't help you much unless your server supports PHP. ;)

Girlinprogress
08-26-2003, 11:03 AM
Sorry...... forgive my ignorance. We also use many scripts.

Is there a script that can be modified?
As you can tell, I can manipulate the scripts, but am by no means a programmer.
Any help would be appreciated!

AdamBrill
08-26-2003, 11:16 AM
Originally posted by Girlinprogress
Is there a script that can be modified? In what language where you thinking? If you mean in Java, I don't know Java, so I can't help you with that...

Girlinprogress
08-26-2003, 11:30 AM
Well, I was thinking a Javascript.... I would love for it to be ASP, but I am limited because of WEB DNA. Lame! :(

AdamBrill
08-26-2003, 11:41 AM
Hmm... it could be done with JavaScript, but it wouldn't be a good idea... Everyone with JS turned off(13%) couldn't see it. Is there a reference site for Web DNA? I've never heard of it and am curious... ;)

Girlinprogress
08-26-2003, 12:06 PM
http://www.girlinprogress.com/webcatalog/

You can access some of the links.....not all of them work.

AdamBrill
08-26-2003, 05:17 PM
Ok... This would be completely lucky, but it looks like this might be what you want:

<!HAS_WEBDNA_TAGS>
<html>
<body>
[include file=/header.inc]
</body>
</html>

Make a file called header.inc and see if it includes it... The only problem with it, is I don't know anything about webDNA, so I don't know how to make it randomize which one is in there... Do you want a JS script to do it? It won't work for people without JS, but you could just put a default one in a <noscript> tag... Want an example?

BTW, why don't you say that you need a new, updated server? :p

Girlinprogress
08-28-2003, 12:22 PM
I have tried, tried, tried.....I pitched ASP mainly.
They don't want to spend the money ...imagine that!

I know how to do the includes, its the javascript part I am unsure of.
I would love and example if you have it.... both the rotating and the nonscript.

AdamBrill
08-28-2003, 01:08 PM
Ok... This is basically how you would do that:<script type="text/javascript">
content = new Array();
content[0] = "This is the <b>first one!</b>";
content[1] = "This is the <b><i>second one!</i></b>";
content[2] = "This is the default <b>one!</b>";
document.write(content[Math.floor(Math.random()*content.length)]);
</script>
<noscript>
This is the default <b>one!</b>
</noscript>Unfortunately, with JS you can't control how many times each one is displayed, so it would just have to be a random thing. The <noscript> at the end is to keep it working for non-JS users... You would just manuelly type it one of the choices in there.

I know where you can get REALLY cheap PHP hosting... ;) Check out DR2 (http://www.dr2.net)

Girlinprogress
08-28-2003, 01:11 PM
Thank u! I will try this.
Its not the hosting aspect.......its paying someone to convert the huge sites we have that have shopping carts and database driven backends and re-writing the applications to run them.
It's very frustrating!

halifaxrick
08-28-2003, 01:17 PM
Just out of interest, could you base which item is displayed by the current time of day? that way each link could be exposed for the same ammount of time each day.


I don't know how to put it in JS, but the logic would be:
If time is xx:x0 - xx:x1 choose link 1
If time is xx:x2 - xx:x3 choose link 1
If time is xx:x4 - xx:x5 choose link 1
If time is xx:x6 - xx:x7 choose link 1
If time is xx:x8 - xx:x9 choose link 1

Rick.

Girlinprogress
08-28-2003, 01:37 PM
Here is what i have

<tr>
<td valign="top">
<script type="text/javascript">
content = new Array();
content[0] = "[include file=http://www.ilovevegas.com/tours/damntest.inc]";
content[1] = "[include file=http://www.ilovevegas.com/tours/damntest2.inc]";
content[2] = "[include file=http://www.ilovevegas.com/tours/damntest3.inc]";
document.write(content[Math.floor(Math.random()*content.length)]);
</script>
<noscript>
This is the default <b>one!</b>
</noscript></td>
</tr>


But, I am getting this error
Error: template 'http://www.ilovevegas.com/tours/damntest.inc' not found

It is there and the includes work on there own.
For example:
http://www.ilovevegas.com/tours/damntest.inc

Any ideas?

AdamBrill
08-28-2003, 02:05 PM
Since the files are external, this is probably the best you can do:<script type="text/javascript">
sites = new Array("http://www.ilovevegas.com/tours/damntest.inc",
"http://www.ilovevegas.com/tours/damntest2.inc",
"http://www.ilovevegas.com/tours/damntest3.inc");
document.write('<iframe style="height:320px; width:300px;" frameborder=0 src="'+sites[Math.floor(Math.random()*sites.length)]+'"></iframe>');
</script>
<noscript>
<iframe style="height:320px; width:300px;" frameborder=0 src="http://www.ilovevegas.com/tours/damntest3.inc"></iframe>
</noscript>It's not the best, but it should do...

Girlinprogress
09-02-2003, 01:21 PM
Thank Adam....this works in most of the browsers.
All but good ole netscape 4.
Is it possible to write something like a browser recognition that handles the info the same as the noscript tag?

AdamBrill
09-02-2003, 03:05 PM
You could do it like this:<script type="text/javascript">
sites = new Array("http://www.ilovevegas.com/tours/damntest.inc",
"http://www.ilovevegas.com/tours/damntest2.inc",
"http://www.ilovevegas.com/tours/damntest3.inc");
document.write('<iframe style="height:320px; width:300px;" frameborder=0 src="'+sites[Math.floor(Math.random()*sites.length)]+'"></iframe>');
if(document.layers){
document.write("<layer height=\"320px\" width=\"300px\" >I'm sorry, this site will not work correctly with such a crappy browser. Please upgrade before viewing this page.</layer>");
}
</script>
<noscript>
<iframe style="height:320px; width:300px;" frameborder=0 src="http://www.ilovevegas.com/tours/damntest3.inc"></iframe>
</noscript>You would change the text to the html source of one of the files. However, I personally would leave it like it is. :D :D

Girlinprogress
09-02-2003, 03:07 PM
LOL! :D
I couldn't agree with you more!
Thanks for your help!!!!!!

AdamBrill
09-02-2003, 03:13 PM
LoL... ;)

However, I wouldn't really leave it like that. It doesn't look very professional. :p :D

Girlinprogress
09-16-2003, 11:05 AM
Ok.... this is so weird.
This WAS working in Netscape 6.0 and above, but now I am getting this.
A screen pops up saying downloading specmem.inc and then says...
You have chosed to download a file of type: "Untyped Binary Data" [application/octet-stream} from the directory where this file is located. But, I don't have an include file of that name.

Any ideas?

AdamBrill
09-16-2003, 11:30 AM
Did you try it on multiple computers? That error sounds like it is a problem with your computer, not the actual code... Try opening it on another computer and see if you get the same results.

Girlinprogress
09-16-2003, 12:26 PM
Ok, figured it out.
Our brilliant MIS guy who left upgraded our IN house server to WebCat 5.0. That's why its not working.
But, what doesn't make sense is that it's an upgrade.
The live site is on WebCat 3.2 and all is well.
Anyways....thanks for your direction.

Back to the frustration!!!!!
:)

pedroriv
10-17-2003, 03:47 PM
Hi Girlinprogress,

The easiest way to do this is to have a a small database with the names of the inclueds in there as follows the db is called includedb.db:

id (tab) theInclude
1 (tab) file1.inc
2 (tab) file2.inc
etc.....

then on the page you do a random search on the page and between the tags you put your includes as follows:


[FoundItems]
[include [theInclude]]



This should give you a random include every time.

Hope that helps, if you need any more assistance let me know, I've worked with WebDNA for over 3 years.