Page 1 of 1

Advertising on Multiple Websites with PHP

Posted: Fri Nov 19, 2004 11:48 pm
by Mr Tech
Hey there,

I'm wanting to set up a network of websites that displays the same advertising banners on each website... However, I don't want to have to update each site if I have 10 different banners to add, remove etc all the time.

What would be the best way to draw advertisements from one site, and display it on the other websites using PHP and MySQL (if needed). Could I use:

Code: Select all

$lines = file('http://www.domain.com/ads.php'); 
foreach ($lines as $line_num => $line) {   
echo $line;
}


Would that load fast enough?

Or maybe Iframes would work...

What would you sugegst?

Posted: Sat Nov 20, 2004 3:31 am
by potsed

Posted: Sat Nov 20, 2004 4:23 am
by Mr Tech
What about linking the banners?

Posted: Sat Nov 20, 2004 5:19 am
by potsed
What about linking the banners?
have the banners inside a folder and point to the banner in a field in your database as well as a pointer url to the site that you want the banner to connect to, Then in the php script connect to and retrieve the pointer and link address then output the link to the

Code: Select all

echo "document.write("<a href='url_pointer'><img src='banner_pointer' /></a>");";
line in the php file...

Posted: Sun Nov 21, 2004 8:44 pm
by Mr Tech
OK thanks.

Is this sort of linking supprot in most browsers? What if JavaScript is disabled in their browser?

Thanks

Ben

Posted: Sun Nov 21, 2004 10:25 pm
by John Cartwright
I dont know why you are echoing javascript in the first place when its as simple as

Code: Select all

<?php

echo  '<a href="url_pointer"><img src="banner_pointer" /></a>'; 

?>