Welcome to WebmasterWorld Guest from 23.20.8.182

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Automatically adding banner to all websites I host

     
12:13 am on Jul 3, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:June 19, 2005
posts:57
votes: 0


Hi WW

I'm really stuck with a problem, has anyone got any tried & tested method of automaticaly adding a banner advert to the header of every web page using Apache?

Pretty Pretty pleaes can someone help :)

Craig

2:31 pm on July 3, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Jan 1, 2004
posts:190
votes: 0


It's an SSI include. First you enable SSI in your .htaccess or httpd.conf

Then you put a file that contains the code for your banner, such as banner.blah

Then you put

<!--#include virtual="/banner.blah" -->

at the top of every file, or wherever in the file you want the code to show up.

Note that include virtual begins looking in your root web directory, as defined in httpd.conf

http://httpd.apache.org/docs/howto/ssi.html [httpd.apache.org]

7:05 pm on July 3, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:June 19, 2005
posts:57
votes: 0


Thanks for your reply BReflection!

I can't edit each web site and put that code in manually. I need an automatic process to do this.

I see other free host's doing this but, when I try using mod_layout or php prepend I find phpbb type sites or CMS's are broken.

Have you got any idea how to do this?

Thanks Craig.

7:45 pm on July 4, 2005 (gmt 0)

Preferred Member

10+ Year Member

joined:May 19, 2005
posts:362
votes: 0


I'm sure you've heard this before...but as a reminder to others:
Do NOT put your AS code into the header of registration or other non-content pages.

Wish I could help with the problem, but I would have guessed what you've been told here.
Hmmm.....(scratches head)

9:35 pm on July 4, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:June 19, 2005
posts:57
votes: 0


Thanks for your reply,

I am trying to inject my Google Banner advert onto the top of all pages that apache web server serves.

I have tried using Mod_layout, but mod_layout has a problem when ob_start is called in PHP (which effects PHP Nuke, PHP BB and others)

I have also tried using php_autoprepend but can mess up up headers.

I am using apache 1.33, and PHP v4.0.11.

I have tested the above using apache 2 and PHP 5. without sucsess.

I have seen many hosting companies add there banner across the top of their customers web pages, how do they do that without effecting customers pages and functionality?

This is a very similiar post i have posted in another forum and I apologise for that.

Thank you!

Craig

12:53 am on July 5, 2005 (gmt 0)

Senior Member from CA 

WebmasterWorld Senior Member encyclo is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Aug 31, 2003
posts:9068
votes: 4


I think you are on the right track - but I've never done this myself so I'm very far from being an expert. You need to use mod_rewrite to send page requests through a Perl/PHP etc. script where you can add the header and echo the rest of the file.

There are several approaches - you can add the markup inline, but a user could use CSS absolute positioning to place something like a graphic which could cover your ads. You can frame the original page and place your ads in a separate frame to the top or the right. One thing to consider is that your script needs to do some sanity checking to ensure that it is not used to access content other than HTML pages or anything outside the document root.

You mention problems with PHP headers - as few of the free hosting providers offer support for server-side scripting for their end users, they are not faced with the same problem as you (ie. that the PHP scripts try to send HTTP headers which due to the prepended file come after some content has already been sent). Perhaps the framed-page approach would help in this case?

5:41 pm on July 5, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:June 19, 2005
posts:57
votes: 0


Hi there,

Thank for your reply, I was wondering, Would putting the site into a frame not cause problems to the layout of the site ect?

Many thanks
Craig.

9:19 pm on July 6, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:June 19, 2005
posts:57
votes: 0


Hi there,

The hunt for a solution gets closer, (I hope lol)

I have been informed that there might be a ready made script/wrapper available that might fix this problem?

Has anyone heard of such a script?