Forum Moderators: phranque
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]
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.
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
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?