|
Posted by Jerry Stuckle on 12/08/07 23:49
@Homeonthecouch wrote:
> Got to be easier if I just post the whole lot so your not guessing,
> Someone else has asked this question on the owners website but he says
> he will be busy with studies until November so I guess it over ran
> whatever it was he was studying.
>
>
> Here's the whole lot then.
>
> I really appreciate your help and patience with this.
> If there is a 'target' value added in, will it still validate in strict
> dtd mode?
>
>
>
> <?php
>
> $option = "banner";
>
> $sites[0] = array("http://www.site1.com", "Text1", 5,
> "images/mybannerimage1.jpg");
> $sites[1] = array("http://www.site2.com", "Text2", 1,
> "images/mybannerimage2.jpg");
> $sites[2] = array("http://www.site3.com", "Text3", 5,
> "images/mybannerimage3.jpg");
> $sites[3] = array("http://www.site1.com", "Text1", 1,
> "images/mybannerimage4.jpg");
>
>
> $countsites = count($sites);
>
> for($i=0; $i<$countsites; $i++)
> {
> for($x=0; $x<$sites[$i][2]; $x++)
> {
> if($option != null)
> {
> $mylist[] = array($sites[$i][0],$sites[$i][1],$sites[$i][3]);
> }
> else
> {
> echo("Error deciding option.");
> exit();
> }
> }
> }
>
> $countlist = count($mylist);
>
> $countlist = $countlist - 1;
>
> $picker = rand(0, $countlist);
>
> if($option == "link")
> {
> echo("<a href='" . $mylist[$picker][0] . "'>" . $mylist[$picker][1] .
> "</a>");
> }
>
> else if($option == "banner")
> {
> echo("<a href='" . $mylist[$picker][0] . "'><img alt='" .
> $mylist[$picker][1] . "' src='" . $mylist[$picker][2] . "' /></a>");
> }
>
> else
> {
> echo("Error deciding option.");
> exit();
> }
>
> //Created by James Barnsley. All rights reserved.
>
> ?>
>
Your biggest problem is that PHP cannot control whether something is
opened in a new window or not. That's strictly client-side - html and/or
javascript.
What you need to do is first of all determine the html code you want to
generate. alt.html will help you here. Once you have that, the php
code should be easy.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|