Advertising on Multiple Websites with PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Mr Tech
Forum Contributor
Posts: 424
Joined: Tue Aug 10, 2004 3:08 am

Advertising on Multiple Websites with PHP

Post 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?
User avatar
potsed
Forum Commoner
Posts: 50
Joined: Sat Oct 09, 2004 12:00 pm
Location: - South Africa

Post by potsed »

User avatar
Mr Tech
Forum Contributor
Posts: 424
Joined: Tue Aug 10, 2004 3:08 am

Post by Mr Tech »

What about linking the banners?
User avatar
potsed
Forum Commoner
Posts: 50
Joined: Sat Oct 09, 2004 12:00 pm
Location: - South Africa

Post 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...
User avatar
Mr Tech
Forum Contributor
Posts: 424
Joined: Tue Aug 10, 2004 3:08 am

Post by Mr Tech »

OK thanks.

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

Thanks

Ben
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post 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>'; 

?>
Post Reply