I want to have a sidebar in my website with navigation in it. I will use script like phpBB etc. but I want sidebar to be displayed on every page.

So I am thinking about making a Sidebar in HTML and then using frame tag for displaying other pages/scripts.

But as Frames are getting obsolute, Is there any other method to display a sidebar in everypage without using frames and without adding html coding on every page?


Yes, frames are getting obsolete. Other methods that allow you to include a single element onto multiple pages include SSI, or a single JavaScript script that adds the element to each page (and each page then calls the single SSI or JS, which can be edited once to update the whole site).

You mention PHP, which can be used to have common elements across a site. You can include a separate PHP script with the include() function, which can include a separate script that draws the navigation. Or you can implement a whole template system, like Smarty, which gives lots of control.

You will have to add some HTML (or PHP or JS if you go that route) to each page, but only a small call to an external source. Ideally the call to the included sidebar won't change in the long run, and any changes to the sidebar will be done in the sidebar file (one edit that updates the sidebar across the site).

  • but man Scripts like phpBB and eyeOS have many Pages/PHP files, How could I add a Code to all the Files?
    – Johnson Smith
    Jan 14 '11 at 17:19
  • @Johnson You shouldn't have to add it to all the files. I haven't used phpBB before but usually with a cms of any type there is a template system in place already you just have to find the right file and edit it. Here's a link that discusses modifying phpBB templates php.about.com/od/phpbb/qt/phpbb_template.htm
    – Joshak
    Jan 14 '11 at 17:30
  • kk man, Let Me Try...BTW is IFRAME a good option too? :-/
    – Johnson Smith
    Jan 14 '11 at 17:33
  • iframe is NOT a good option for including a navigation bar. phpBB has "styles" which are the template that gets applied to each page in the forum setup. Adding code to the Style files will get it included on the relevant pages within the forum. Read up on Style creation for phpBB system (phpbb.com/styles/faq) and you should be fine. Jan 14 '11 at 17:38
  • Thanx Man :) Appreciate the Effort..
    – Johnson Smith
    Jan 14 '11 at 17:42

The easiest way to accomplish this is by changing all of your pages to .php extension. You can still use HTML in them. You can then use something like this: In the "sidenav.php" file you have your navigation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy