Uzumaki-Naruto 0 Report post Posted October 17, 2005 You see when you want to make a big website with a navigation bar on each page . you have to put the links on every page . And when you want to add a new link you have to add all them to the pages . Now there is a way ... iframes are one way but some web browsers do not support iframes . Is there any other way i could do this ? Share this post Link to post Share on other sites
szupie 0 Report post Posted October 17, 2005 You can make a page with just the navigation bar, and include it in all the pages on you site. You can use javascript to do that (I don't know much about javascript, though), or you can use php to do that, which is what I've done. Use include('<you navigation page here>'>) to add the navigation page on your pages. Xisto has php, so you can use it on the site you'll have here. Share this post Link to post Share on other sites
Hercco 0 Report post Posted October 17, 2005 The trick is to do some serverside processing. Let me explain. Instead of manually editing every page (html file) and adding the menu, you make a separate file containing the html code for the menu and include it to each of your pages. The including is done with some server side technique. In practice you use either Server Side Includes (SSI) or some serverside scripting language (ASP, PHP, JSP). In SSI you include the files like this <!--#include virtual="relative/path/to/file.ext" --> In order SSI to work the server must support it and the file extension must be corrent. Usually it is .shtml but is configurable so can be anything. It can be configured to .html or .htm so you don't even need to change the extension. And I mean the extension for the file in which that #include call resides. SSI is quite old method and is probably less likely to be installed on a server than PHP for example. So I'd recommend you to go with PHP as it does the trick just as easy (even faster). In php you include file with this kind of call <?php include('path/to/file.ext');?> <?php marks the beginning of PHP code (so that the parser can find it) and ?> the end. The path to the file can be either relative or absolute. Instead of include() you could use function require(). Require requires the the file is found and can be included. If the file is not found the script will terminate and error message is displayed. the syntax for the call is exactly the same. I've heard that some webhosts have disabled include (for some reason) so you have to use require. Anyways it works just the same. In order to your PHP code get processed the files must be named with the extension .php. (index.php) for example) Share this post Link to post Share on other sites
minnieadkins 0 Report post Posted October 17, 2005 So basically you have a file called "navigation.php" then you have your index.php, page1.php, page2.php. If your pages (page1, page2) are dynamic then you just add the include statement to generate your menu while you generate it. Butif you manually code it, you put in the include("./filetoinclude") statement?I've seen a lot of pages with menus that only load like the right hand side of the screen. As to give you an illusion that the menu is static, while it only loads the content needed. Is this just an illusion, or is that actually what happens? I'm kinda curious on this as well. Share this post Link to post Share on other sites
evought 0 Report post Posted October 17, 2005 You see when you want to make a big website with a navigation bar on each page . you have to put the links on every page . And when you want to add a new link you have to add all them to the pages . Now there is a way ... iframes are one way but some web browsers do not support iframes . Is there any other way i could do this ? 1064326480[/snapback] Besides the PHP and Javascript routes, there is the XML stylesheet route: Generate your site content in an XML dialect (e.g. docbook) and use a stylesheet to generate the X/HTML and provide the CSS. Then, the navbar, footer, header, *is* actually embedded in each (HTML) page, but not in your original source (the XML) and the stylesheet keeps everything up to date. ---- The downside to all of these is problems with caching of documents. With the PHP or Javascript route, the last-modified date usually ends up being the modified time of the main page. If the navbar is newer, the client may not reload it. With the XML route, every time you update the navbar, header, footer, etc, all pages get marked as new and no caching happens. With frames or the Object tag, the browser can reload only the pieces which are actually out of date and performance is generally much better. As you have noted, however, some browsers are still squirrelly with the Object tag or with iFrames. It is possible using PHP to look at the browser and use either an Object tag or a direct include based on the browser type. This ends up with the best possible performance but gets complex. When my site got to the point where this was a pain, I just went to a CMS that handled all of the overhead for me. Share this post Link to post Share on other sites