Welcome Guest ( Log In | Register )




                Web Hosting

 
Reply to this topicNew Topic
Big Sites With No Frames, i cant find a way !
Uzumaki-Naruto
post Oct 17 2005, 10:26 AM
Post #1


Newbie [ Level 2 ]
Group Icon

Group: Members
Posts: 27
Joined: 17-October 05
Member No.: 9,155


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 ?
Go to the top of the page
 
+Quote Post
szupie
post Oct 17 2005, 12:27 PM
Post #2


S.P.A.M.S.W.A.T.
Group Icon

Group: Members
Posts: 814
Joined: 22-January 05
From: San Antonio, Texas (No, I'm not dumb. I just moved here...)
Member No.: 2,284


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. Astahost has php, so you can use it on the site you'll have here.
Go to the top of the page
 
+Quote Post
Hercco
post Oct 17 2005, 12:36 PM
Post #3


Super Member
Group Icon

Group: Members
Posts: 595
Joined: 4-September 04
Member No.: 228


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

CODE
<!--#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

CODE


<?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)
Go to the top of the page
 
+Quote Post
minnieadkins
post Oct 17 2005, 04:25 PM
Post #4


Premium Member
Group Icon

Group: Members
Posts: 292
Joined: 15-December 04
Member No.: 1,768


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.
Go to the top of the page
 
+Quote Post
evought
post Oct 17 2005, 04:54 PM
Post #5


Premium Member
Group Icon

Group: Members
Posts: 200
Joined: 3-October 05
From: Missouri
Member No.: 8,888
myCENTs:71.12


QUOTE(Uzumaki-Naruto @ Oct 17 2005, 05:26 AM)
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 ?
[right][snapback]57107[/snapback][/right]


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.
Go to the top of the page
 
+Quote Post

Reply to this topicNew Topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts   12 breeze_1000 2,043 21st December 2008 - 08:57 AM
Last post by: kpxchunsa
No New Posts 8 smyke 1,872 2nd December 2008 - 11:59 PM
Last post by: iG-kondwani
No New Posts   5 Ed :P 1,248 26th November 2008 - 06:58 PM
Last post by: iG-jonny
No New Posts 9 FirefoxRocks 1,971 25th November 2008 - 09:42 PM
Last post by: iG-Sientz
No New Posts   0 TavoxPeru 136 14th November 2008 - 08:57 PM
Last post by: TavoxPeru
No New Posts   0 khalilov 190 4th November 2008 - 06:11 PM
Last post by: khalilov
No New Posts   5 smyke 1,103 28th October 2008 - 06:44 PM
Last post by: Guest
No New Posts   3 mzwebfreak 884 23rd October 2008 - 06:18 PM
Last post by: noodle
No New Posts   4 liveblue 317 11th October 2008 - 07:15 PM
Last post by: MoonLightCity
No New Posts   1 spocrep 240 2nd October 2008 - 12:27 AM
Last post by: nunocordeiro
No New Posts 4 Funtoosh 1,473 24th June 2008 - 03:58 AM
Last post by: iGuest
No new   60 r3d 7,065 19th June 2008 - 08:45 AM
Last post by: Atomic0
No New Posts   1 Neblett25 311 17th June 2008 - 02:40 PM
Last post by: yordan
No new   29 noddy 18,593 4th June 2008 - 04:53 PM
Last post by: iGuest
No new   25 Kaimukichick07 15,058 31st May 2008 - 09:19 PM
Last post by: iGuest