homepage Welcome to WebmasterWorld Guest from 50.16.130.188
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Automatically adding banner to all websites I host
CraigMyers




msg:1495490
 12:13 am on Jul 3, 2005 (gmt 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

 

BReflection




msg:1495491
 2:31 pm on Jul 3, 2005 (gmt 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]

CraigMyers




msg:1495492
 7:05 pm on Jul 3, 2005 (gmt 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.

Heartlander




msg:1495493
 7:45 pm on Jul 4, 2005 (gmt 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)

CraigMyers




msg:1495494
 9:35 pm on Jul 4, 2005 (gmt 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

encyclo




msg:1495495
 12:53 am on Jul 5, 2005 (gmt 0)

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?

CraigMyers




msg:1495496
 5:41 pm on Jul 5, 2005 (gmt 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.

CraigMyers




msg:1495497
 9:19 pm on Jul 6, 2005 (gmt 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?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved