I've inserted 'anycontent at the bottom of my main page, and I'm trying to test a banner rotation.
Quote'anycontent': inserts php-generated custom content that YOU have coded into the file 'anycontent.php' and displays the content on the index page. It can be used to include banner-rotation scripts, welcome scripts, or similar. Where it appears in the index page is determined by it's placement in the string example below.
I have this code for random images:
<?php
header("Content-Type: image/jpg");
$sigs = array();
$sigs[] = "http://www.oneuk.f2s.com/images/rand/test1.jpg";
$sigs[] = "http://www.oneuk.f2s.com/images/rand/test2.jpg";
$sigs[] = "http://www.oneuk.f2s.com/images/rand/test3.jpg";
mt_srand((double)microtime()*1000000);
$sig = $sigs[mt_rand(0, count($sigs)-1)];
readfile($sig);
?>
How would I insert this code? Somewhere in anycontent.php?...
<?php
if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');
starttable("100%", "Welcome");
?>
<tr><td class="tableb" >
This is for any content block - just a test - Edit the file "anycontent.php" to change what is shown here
</td></tr>
<?php
endtable();
?>
That code is not designed to be used in this way. It is intended to be called as an image, so call it using an img tag.
OK, just one thing I used the original code for the script I got, and it worked:
<?php
header("Content-Type: image/jpg");
$sigs = array();
$sigs[] = "http://uberhost.com/siggy.jpg";
$sigs[] = "http://uberhost.com/mysig.gif";
$sigs[] = "http://freehost.net/somegig.png";
$sigs[] = "http://http://img222.exs.cx/img225/3973/milf324f.jpg";
mt_srand((double)microtime()*1000000);
$sig = $sigs[mt_rand(0, count($sigs)-1)];
readfile($sig);
?>
But obviously I don't want them ads on my page.
Sorry if I'm asking a daft question here. "so call it using an img tag". How would I do this?
Just trying something else aswell at the mo.
<img src="whateveryoucalledthatscript.php" alt="banner" />
Well I fixed it with a completely different script someone came up with for me :)
<?php
$banners = array(1 => 'test1.jpg', 2 => 'test2.jpg', 3 => 'test3.jpg');
$random = rand(1,3);
$banner = "http://www.oneuk.f2s.com/images/rand/" . $banners[$random];
echo "<p style='text-align: center'><img src='" . $banner . "' alt='' /></p>";
?>
Hi,
using John's random image script, how do you link the image when it comes up to another page?
pse help - I don't know enough of PHP to amend the script - I tried but nothing works.
thanks.
Hi again,
I got it working after trying again,
just use <a href="http://yoursite.com/yourpage.php"> in front of the image or the image block.
thanks.