views:

371

answers:

7

How can I place a banner on webpage with one application to all pages of a website ?

A: 

Well, hopefully you would have designed the website so that if you need to change something globally, you can just edit a header or footer file.

If not, I would use Perl to go through all the files, and do a search and replace.

Alex Fort
A: 

You can just create a header file that you include in all your pages, and include the banner code in it. The solution is pretty much the same in all languages. If your host allows server-side includes, you can even do exact same thing with (nearly) pure HTML. You can also do it with JavaScript pretty easily.

sli
A: 

Do you have a global template for all your pages? Something where the basic structure of all your pages is defined while the specific stuff is filled into parts of the body? If you had something like this you could modify the global template to have the banner you want and it would show on all your pages.

Google "html templating" for more.

Doug T.
+2  A: 

One way of doing this is to put your banner into a file, then include that one on each of your other pages. This way, you only have to change the code in one place to update the banner site-wide.

So, a PHP example would be:

banner.inc.php:
<?php
  // echo out banner here...
?>

Then, on your other pages:

include("banner.inc.php");
ConroyP
A: 

I recommend using master pages. That way if you have something that has to be changed globally across the project you only have to change it in one place. And they are really simple to use.

jmein
A: 

If your web server is IIS, and you know a smidge of CSS you can do this without perl, without touching any other files, but at the cost of some performance.

IIS allows you to insert an HTML snippet into anything served: http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/e27f918e-89a9-45a8-8604-2ad2ded09d64.mspx?mfr=true

If said footer file, had CSS which shoved it to the top, then you would get the behavior you are looking for.

Please note, that this is NOT an ideal solution, but it is a quick and dirty patch until you can go back and retrofit all of your pages with a master page or something similar.

Stephen Wrighton
A: 

If it really should be on every page of your site, I'd argue that it's part of the site design rather than the content itself. In this case, you are easily justified in setting a background-image in your css. Of course, you probably then still have to have some sort of place-holder element in your html, but at least you could update the whole site together.

Dominic Cronin