Others > News

Spice up the front page...

<< < (3/5) > >>

CARBON:

--- Code: ---

<?

$content = &quot;<div align=\&quot;center\&quot;>&quot;;
$content .= &quot;<img src=\&quot;&quot;;

## Change this line. Change YourPhotoDirectory/ to whatever folder your pics are in.
$content .= getRandomImage('YourPhotoDirectory/');

$content .= &quot;\&quot;><br />&quot;;
$content .= &quot;</div>&quot;;

function getRandomImage($dir,$type='random')
{
global $errors;

if (is_dir($dir)) {  

$fd = opendir($dir);  
$images = array();

while (($part = @readdir($fd)) == true) {  

clearstatcache();

if ( eregi(&quot;(gif|jpg|png|jpeg)$&quot;,$part) ) {
$images[] = $part;
}
}

srand ((double) microtime() * 1000000);
$key = rand (0,sizeof($images)-1);

return $dir . $images[$key];

} else {

$errors[] = $dir.' is not a directory';
return false;

}
}

echo &quot;$content&quot;;

?>


--- End code ---


Hey Sheep. Just paste this in and then upload all the photos into a folder on the server. Then just point it at the right folder. The script will count the photos in the folder and then will just randomly show one of them when the page is loaded.

sheepdog:

--- Quote from: freebirdrider27 ---so that means the ones we sent you arnt going up??
--- End quote ---


Yes, they will.
Just means I have more.

sheepdog:

--- Quote from: mac15 ---Sheep how about fixing the urls so they don't force the links to open in new pages. For example the forums link is


--- Code: ---<a href=&quot;http://bikeguide.org/forums/&quot;>forums</a>
--- End code ---


instead use


--- Code: ---forums
--- End code ---

--- End quote ---



I doesn't open in a new window, and your coding is wrong.
A target reference dictates if it opens in a new window, NOT using the full url.


--- Code: ---Target=_blank
--- End code ---
(or similar code) will open a  new window.

All you did was shorten the URL. Not sure why yours is opening in a new window, but it shouldn't.


The shortcuts on the links page was causing some issues but I fixed that yesterday.

sheepdog:

--- Quote from: CARBON ---
Hey Sheep. Just paste this in and then upload all the photos into a folder on the server. Then just point it at the right folder. The script will count the photos in the folder and then will just randomly show one of them when the page is loaded.
--- End quote ---



Very cool thanks!

Its up.


So are all the pics I have on hand.*

*as soon as they finish uploading (they are uploadinga s I write this).

CARBON:
No problem.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version