PHP include help!

They have: 7 posts

Joined: Jan 2009

Ok i have this working script now thanks to a member here:

Quote:
<?
//populate following array with image urls
$images = Array(
"http://www.xninelivesx.com/header_1.jpg",
"http://www.xninelivesx.com/header_2.jpg",
"http://www.xninelivesx.com/header_3.jpg",
"http://www.xninelivesx.com/header_4.jpg",
"http://www.xninelivesx.com/header_5.jpg"
);

$random_image = $images[rand(0,count($images)-1)];

echo "";
?>

that works perfect.. now i need to use it as an include on my forums.. please give me the right code!

thanks,

teammatt3's picture

He has: 2,102 posts

Joined: Sep 2003

Did you forget about this post at Digital Point where you copied it from?
http://forums.digitalpoint.com/showthread.php?p=8441783

decibel.places's picture

He has: 1,494 posts

Joined: Jun 2008

teammatt3 wrote:
Did you forget about this post at Digital Point where you copied it from?

That post does not have a reply, so the poster is [still?] looking for help making it an include.

nikee,

there is a tutorial about PHP include at W3Schools

basically, you want to save this code as a PHP file, let's say you call it randomimage.php

if it is in the same directory as the page including it on your server, use this code to include it:

<?php include("randomimage.php"); ?>

if it's not in the same directory, you need to put the relative or absolute path to it

The page where you put the include code needs to be a PHP file or you need PHP enabled in HTML (try it first to see if it works already).

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

That post has NINE replies to it on the day it was posted (July 9, 2008) and the day after.

And this posting from August of the same message has a reply as well:

http://www.webmasters.org/forum/php-forum/1039-php-include-help.html

I just checked one of his other posts, where that question is found on several forums as well, although those are more recent posts) and each posting has different links in the footers....

One of the links in a footer on a post was for a "link building service"....

-Greg

decibel.places's picture

He has: 1,494 posts

Joined: Jun 2008

Greg K wrote:
That post has NINE replies to it on the day it was posted (July 9, 2008) and the day after.

Guess I missed that Sad

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

lol, it's one of those sites that display a big add under the initial post, may have been why.

-Greg

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.