Help - Search - Members - Calendar
Full Version: Navigation Bar Question...
Zymic Webmaster Forums > Web Design & Development > General Web Design Discussion
tboi
on my site I have quite a few pages but when I add a new link I don't want to go into every html file and edit the href"". How would I be able to save my Main navigation bar in an external file and then import it to my main code? Would I use
CODE
<src="#">
or
CODE
@import url('')
k.digennaro
could use a php include, most people just create one html document and one css document that contains the basic structure of the site, the header footer nav, any elements that will be on basically every page, then they just copy and paste that into all the pages and create the content an example is my site (click my sig).

to use a php include you would first start by creating a separate document with your nav, then on any page that you want the nav insert
CODE
<? include("nav.php"); ?>
where you want it.
Note that you would have to change your pages from .html to .php for this to work although the coding would be exactly the same.

Kevin DiGennaro
tboi
Thanks, are there ways to do this client-side?
swordz
Yes, using the evil of iFrames. They're appalling things, bad for SEO, bad for browsing, and people can access part of a page but not the whole thing.

Use includes. Server side is faster, and more secure.

swordz
MrTouz
QUOTE(swordz @ Feb 9 2009, 11:30 AM) *
Yes, using the evil of iFrames. They're appalling things, bad for SEO, bad for browsing, and people can access part of a page but not the whole thing.

Use includes. Server side is faster, and more secure.

swordz



lol i love how you put it. I will second that !
tboi
Okay, thanks...but the <? include...?> thing doesn't work...where can I get php? I have xxamp, is that good?
MrTouz
Should be (should as i do it... it always works :
CODE
<?php include "this.php"; ?>


The page you are putting this into MUST and again i repeat MUST be in .php extension, putting PHP code inside an HTML page will NOT work. Convert all your pages to PHP anyways.

.html = using HTML only
.php = using HTML & PHP

(now YES you can use php inside an .html page... but that's a whole other story tongue.gif)
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.