• 0

content bar on websites...


Question

this has been bothering me for a while and i just couldn't figure out how they do it....

Most websites has a content bar to the left of their pages and this content bar appears on everysingle page....

What do they do so that a content can appear on every webpage and one you update it, all pages' content bar gets updated........

i'm not looking for frames, because they look ugly........so, is there another way to do it...?

Link to comment
Share on other sites

15 answers to this question

Recommended Posts

  • 0
this has been bothering me for a while and i just couldn't figure out how they do it....

Most websites has a content bar to the left of their pages and this content bar appears on everysingle page....

What do they do so that a content can appear on every webpage and one you update it, all pages' content bar gets updated........

i'm not looking for frames, because they look ugly........so, is there another way to do it...?

a content bar, like a menu? most sites are probably using some server side scripting, where they code the content bar as a separate file and then just include it on every page they need it on.

Link to comment
Share on other sites

  • 0
just use php and include the template for each page

<?php

include(menu.php);

?>

if i use php, won't the name of those pages become *.php? but i want it as html......is that possible...?

Link to comment
Share on other sites

  • 0

its gotta be server side

if your that botherd about a html extension you can use *.phtml (is that still supported)

tha basic of the page will still be html its just that php tells the server how to put the pages together

Link to comment
Share on other sites

  • 0
you can use *.phtml (is that still supported)

just get the server to parse .phtml files as php,

you could even set it to do that for html files and save all the files with a html extension, but that may cause problems with normal html files?

Link to comment
Share on other sites

  • 0
you could even set it to do that for html files and save all the files with a html extension, but that may cause problems with normal html files?

I dont think it would - PHP will just scan over a file until it reaches the <?php ?> tags, anything outside of them is ignored.

Link to comment
Share on other sites

  • 0

i guess you can also use javascript to do it:

&lt;script language="javascript" src="menu.js"&gt;&lt;/script&gt;

and then in your menu.js, have a whole bunch of:

document.write("&lt;b&gt;hello world&lt;/b&gt;");

Link to comment
Share on other sites

  • 0

If all you want to do is create a menu bar that is common to all the pages in your site, then a ready-made script wouldn't really be necessary.

Just put this:

&lt;?php include ("filename.html"); ?&gt;

in each page wherever you want the menu to appear, where filename.php is the name of the menu file that contains the menu.

e.g:

http://www.ukaskew.com/navbar.php is the menu bar that appears on all the pages of http://www.ukaskew.com/ , simply include()d in PHP.

To make PHP parse all html files, put the following code in a file called .htaccess on your server.

&lt;Files "*.html"&gt;
ForceType application/x-httpd-php
&lt;/Files&gt;

Hope this helps :)

Link to comment
Share on other sites

  • 0
are there pre-done scripts that i can use..?

i just quickly put this together... not the fanciest or anything... just wanted you have a general idea so you can make your own

in your index.html

&lt;html&gt;&lt;head&gt;&lt;title&gt;title&lt;/title&gt;&lt;/head&amp; #62;

&lt;body&gt;
&lt;table width="100%"&gt;
 &lt;tr&gt;
 ?&lt;td width="30%"&gt;
 ? &lt;script language="javascript" src="a.js"&gt;&lt;/script&gt;
 ?&lt;/td&gt;
 ?&lt;td width="*"&gt;
 ? &lt;h1&gt;hello&lt;/h1&gt;
 ? blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah 
 ?&lt;/td&gt;
 &lt;/tr&gt;
&lt;/table&gt;

in a.js

document.write("&lt;table&gt;");
document.write(&amp;a mp;# 34;&lt;tr&gt;&lt;td&gt;&lt;a href='./page1.html'&gt;item 1&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;");
document.write("&lt;tr&gt;&lt; td&gt;&lt;a href='./page2.html'&gt;item 2&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;");
document.write("&lt;tr&gt;&lt; td&gt;&lt;a href='./page3.html'&gt;item 3&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;");
document.write("&lt;tr&gt;&lt; td&gt;&lt;a href='./page4.html'&gt;item 4&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;");
document.write("&lt;/table&gt;&amp; amp; #34;);

Link to comment
Share on other sites

  • 0
if i use php, won't the name of those pages become *.php? but i want it as html......is that possible...?

Why does that matter though? The only difference is the filename, and that it'll be parsed by php. There is no detriment to having php parse it...

Link to comment
Share on other sites

  • 0
if i use php, won't the name of those pages become *.php? but i want it as html......is that possible...?

Why does that matter though? The only difference is the filename, and that it'll be parsed by php. There is no detriment to having php parse it...

maybe so it's all secretive and people think he's good at updating things on all the pages. :blink: :)

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.