Jump to content

How does Wikipedia display banners on everypage?


Allen Lawson

Recommended Posts

Hey there,I was wondering how at times Wikipedia displays that banner at the top of every page when they want one to be there. I use php inlcudes for my website but I know thats probably not what there using because sometimes there is no banner. I guess another great example would be how YouTube sometimes haves alerts for new things going on at the top. Any thoughts / how to do this would be great! Thanks, Allen Lawson

Link to comment
Share on other sites

The concept is very simple, but implementation vary widely. A CMS could handle how to output banners, or perhaps a PHP include. You could always try Googling how Wikipedia engineers their site if you are really interested.

Link to comment
Share on other sites

Content managing systems can be very complex. With your level of experience, just use include on the pages you want it to appear. If you have one index page that manages sections, you can use switch() if you want to filter pages.

/* Example 1: Put the banner only on these pages */switch($page) {  case 'home':  case 'contact':  case 'about':  include 'banner.php';} /* Example 2: Put the banner on all pages except these ones */switch($page) {  case 'home':  case 'contact':  case 'about':  break;  default:  include 'banner.php';}

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...