homepage Welcome to WebmasterWorld Guest from 54.211.138.180
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
Creating Links one time for the whole site?
Ryuzaki_786




msg:3681898
 9:44 pm on Jun 23, 2008 (gmt 0)

I am coding a web page currently, how would I go about coding it in a manner that I don't have to cut and paste the navigation bar in every page?

 

4css




msg:3681929
 10:25 pm on Jun 23, 2008 (gmt 0)

Use server side includes. One text file with the insertion of a bit of code and viola, your entire code is inserted and you have your navigation. This is also good for header and footer information

<!--#include virtual="/ssi/navbar.shtml" -->

From what I have learned, you are always supposed to save your pages with the .shtml extension. I have used them and I love them.

Also, create a directory for all your includes to be held in. If you use them for more then your navigation.

Hope this helps!

4~css!

lavazza




msg:3681964
 11:24 pm on Jun 23, 2008 (gmt 0)

If you have php, you can use php includes in a very similar fashion

<?php include ("myIncludesDirectory/myNavBar.php"); ?>

Such a file like myNavBar.php would contain the EXACT same bits of html code and nothing else... i.e. for a navBar, just the links, no <head> or <body> tags, etc)

I think that a file like navbar.shtml would have to have the <head> and <body> tags...
maybe I'm wrong...

This is also good for header and footer information

The php approach (and maybe the .shtml approach, too?) is good for ANY repetitive data...

e.g. DOCTYPE and MIME type declarations (ought to be useful when HTML5 comes out)
meta tags in the <head>
etc
:)

bogat




msg:3682523
 4:34 pm on Jun 24, 2008 (gmt 0)

I think that a file like navbar.shtml would have to have the <head> and <body> tags...
maybe I'm wrong...

Maybe I'm wrong, but I don't use head and body tags in any of my ssi. I do just the same as php include - exact code and nothing else.

4css




msg:3682779
 10:19 pm on Jun 24, 2008 (gmt 0)

The file that you are creating as an include would just include the portion of the area that you are using. Such as the navigation.

What you would do is take the whole area of the list that you are using. If I have the list within a div, I just cut the information out of the div, put it into a text file and insert the ssi code. It is really easy to do.

You can always do a search on google for tutorials on this. There are a number of them out there that are really great to read.

rocknbil




msg:3682796
 10:46 pm on Jun 24, 2008 (gmt 0)

Just to clarify, you can use SSI's to include ANY valid data - some useful examples -

- Plain text file (no headers required, a single word, even)

- output from a script or a compiled program (see SSI man. for exec directive). In this case, you must print content-type: text/html headers from your external program (or other valid content-types.)

- RSS/XML (but your document has to be a valid XML/XHTML doctype and you have to provide XML headers)

- image or other binary data

Basically anything you can output in a page you can include in the page using SSI. It doesn't have to be a valid HTML/XHTML document - in fact, doing so might screw up a perfectly valid document:

<html><head><title>Title</title><body>
<!-- below is my include, do the math! -->
<html><head><title>Include</title></head><body>
<p>Two plus Two.</p>
</body></html>
<!-- End of my include -->
</body></html>

The data you include becomes part of the page, so you just validate the entire .shtml with all the data imported.

In older server O.S's the use of SSI's presented serious security flaws and it was a memory hog (because it parses files before reading instead of straight serving) but it's no longer the case.

novustek




msg:3685180
 2:07 pm on Jun 27, 2008 (gmt 0)

If your using dreamweaver just use the template function. I can see the magic word here is "codeing" and to create that would be hard, but i found the template system quite useful and so much faster.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved