Click here to get back home

force users to different pages?

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
force users to different pages? Geoff Cox 03-21-2008
Posted by Geoff Cox on March 21, 2008, 4:58 am
Please log in for more thread options
Hello

Say I have a welcome page and 2 other pages, a.htm and b.htm.

How can I guide visitors, alternately to a and to b?

Cheers

Geoff

Posted by Jonathan N. Little on March 21, 2008, 9:40 am
Please log in for more thread options
Geoff Cox wrote:
> Hello
>
> Say I have a welcome page and 2 other pages, a.htm and b.htm.
>
> How can I guide visitors, alternately to a and to b?
>

Put a gun to their head?

Not enough information, and not sure it is a good idea.

Do you mean alternated links from one visitor to the next? if so that
would require recording the which link was last presented on the server.

Or do you mean alternate for a single visitor upon subsequent visits?
That would require a persistent cookie.

A much simpler method would be a link randomizer.

<?php

$links = array('a.html','b.html','c.html','d.html');
$last=count($links)-1;
$link=$links[rand(0,$last)];

echo "<a href=\"$link\">Mystery Tour</a>";

?>

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com

Posted by Geoff Cox on March 21, 2008, 11:35 am
Please log in for more thread options
On Fri, 21 Mar 2008 09:40:41 -0400, "Jonathan N. Little"

>A much simpler method would be a link randomizer.
>
><?php
>
>$links = array('a.html','b.html','c.html','d.html');
>$last=count($links)-1;
>$link=$links[rand(0,$last)];
>
>echo "<a href=\"$link\">Mystery Tour</a>";
>
>?>

Thanks Joanathan,

when I use the above I get

Mystery Tour"; ?>

I must be missing something?

Cheers

Geoff


Posted by Jonathan N. Little on March 21, 2008, 11:46 am
Please log in for more thread options
Geoff Cox wrote:
> On Fri, 21 Mar 2008 09:40:41 -0400, "Jonathan N. Little"
>
>> A much simpler method would be a link randomizer.
>>
>> <?php
>>
>> $links = array('a.html','b.html','c.html','d.html');
>> $last=count($links)-1;
>> $link=$links[rand(0,$last)];
>>
>> echo "<a href=\"$link\">Mystery Tour</a>";
>>
>> ?>
>
> Thanks Joanathan,
>
> when I use the above I get
>
> Mystery Tour"; ?>
>
> I must be missing something?
>

1) your server must support php

2) the page is named with a ".php" extension (normally for most server
setups)

3) attention to the escaped quotes

echo "<a href=\"$link\">Mystery Tour</a>";
^ ^
or concatenate with single quotes

echo '<a href="' . $link . '">Mystery Tour</a>';

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com

Posted by Michael Fesser on March 21, 2008, 4:49 pm
Please log in for more thread options
.oO(Jonathan N. Little)

>3) attention to the escaped quotes
>
> echo "<a href=\"$link\">Mystery Tour</a>";
> ^ ^
>or concatenate with single quotes
>
> echo '<a href="' . $link . '">Mystery Tour</a>';

Or simply

echo "<a href='$link'>Mystery Tour</a>";

HTML also allows single quotes, which avoids both the ugly escaping and
concatenations in the script.

Micha

Similar ThreadsPosted
question about tailored IFrame pages for IE users May 20, 2005, 10:32 am
Safari users, help please September 12, 2005, 7:09 am
Validating Users to a site August 17, 2005, 7:56 pm
Is a "ZIP" extension the ONLY way to force a "SAVE AS" for your PDF? August 10, 2004, 1:43 pm
How to force a page to be into a frame? October 8, 2005, 5:47 am
Force CSS on external site? December 13, 2004, 6:00 pm
force download of a file February 3, 2006, 2:43 pm
force larger image into same February 21, 2008, 3:59 am
Dreamweaver MX - advanced users question. April 4, 2005, 8:59 pm
Image Not Displaying for Some Firefox Users May 31, 2007, 11:21 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap