Jump to content

Website affiliate system


Urbanturf

Recommended Posts

Hey, sorry for being a total noobstick, but im just kinda learning php for my site...

So heres the deal, im going to have a lot of pages, and i want to be able to show affiliates on that bottom bar, and every time i add or take off an affiliate i don't want to edit EVERY SINGLE PAGE...

 

Heres the site:

www.urbanturf.net/index

 

so i figured i could make a file called "affiliates.php" and then on the index, or whatever page just put this code in

 

								<?PHP
								include("affiliates.php");
							?>

and in affiliates.php i put this code in...

<?php
echo "<table cellpadding=\"0\" cellspacing=\"0\" width=\"700\"><tr><td align=\"center\" valign=\"top\">
<a href=\"http://www.munchymedia.com/\"><img src=\"affiliates/munchymedia.jpg\"></a>
</td></tr></table>"
}; ?>

 

Can anyone help me? Sorry for being a total noob once again, and i would of looked for a tutorial, but i have no clue what they call this!

if anyone can tell me what im doing wrong or help me find a tut id be very greatful and free Bj's..

 

THANKS :D

Link to comment
Share on other sites

Not sure if this is proper placement for this thread, anyways, you have the basic idea right with the include and external file, however you should create a function inside of the external file.  Then on your pages you can call this function and it will display the info you want it to.

 

in external file... function affiliates(){echo "I love all my affiliates.";}

on each page include "file.php"; and when you call it... affiliates();

Link to comment
Share on other sites

Not sure if this is proper placement for this thread, anyways, you have the basic idea right with the include and external file, however you should create a function inside of the external file.  Then on your pages you can call this function and it will display the info you want it to.

 

in external file... function affiliates(){echo "I love all my affiliates.";}

on each page include "file.php"; and when you call it... affiliates();

 

alright so in the affiliate.php (external) i put

<?php
function affiliates(){echo "I love all my affiliates.";}
?>

and the index i put

								<?PHP
								include("affiliates.php");
							?>

 

now it shows nothing ><

Link to comment
Share on other sites

ok.  what i am gathering is this:

 

you want to be able to advertise your affiliates at the bottom of the page.  something like a "this site sponsored by" area.

 

what you could do is have a random image script run. 

following is the random image script.  dont remember where i got it, but oh well.

<?php

/*
* Name your images 1.jpg, 2.jpg etc.
*
* Add this line to your page where you want the images to 
* appear: <?php include "randomimage.php"; ?>
*/ 

// Change this to the total number of images in the folder
$total = "11";

// Change to the type of files to use eg. .jpg or .gif
$file_type = ".jpg";

// Change to the location of the folder containing the images
$image_folder = "images/random";

// You do not need to edit below this line

$start = "1";

$random = mt_rand($start, $total);

$image_name = $random . $file_type;

echo "<img src=\"$image_folder/$image_name\" alt=\"$image_name\" />";

?>

 

copy and paste the code and save it as randomimage.php

 

at the bottom of the page add a row and include the file.

 

just make sure that the images are the right size.

 

Link to comment
Share on other sites

im still not doing it right =(  do i need to give my sql info or somin? anyone have aim or an instant messenger?  this is what i got so far though...

 

index.php ....

<?php affiliates();?>

affiliates.php

<?php
function affiliates(){echo "I love all my affiliates.";}
?>

Link to comment
Share on other sites

index.php

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

 

affiliates.php

<?php
function affiliates() {
echo "I love all my affiliates.";
}
?>

 

Clean up that code, and you forgot the include. Function is voided without.

 

Curse you Film  :D

 

Link to comment
Share on other sites

GUYS IT WORKED!!!!!! THANKS SO MUCH!!!!!!1

you guys were so helpful, and no1 called me a dumb noob or anything lol

appriciate it guys!

 

That is one thing I respect about this community, I haven't seen any maligning, it's a learning enviroment sure, but even then you still expect some form of critisism, and that's pretty cool.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.