Jump to content
Allen Lawson

How does Wikipedia display banners on everypage?

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

Share this post


Link to post
Share on other sites

They have a content management system. While it might have includes somewhere in the code, it uses a program to determine what to write and where.

Share this post


Link to post
Share on other sites

But you have no idea how to code for this kind of thing - or even what language you use to craft something like this?

Share this post


Link to post
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.

Share this post


Link to post
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';}

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...