Forum Moderators: open
So far - this is what I have - and I don't know what it is called.
this is on my main html page - hopefully calling the .php page I have loaded
<iframe marginwidth="0" marginheight="0" width="468" height="30" scrolling="no" frameborder=0 src="http://www.example.com/navbar.php">
</iframe>
Now when I click on any of the links on the nav bar - they open in the frame - and not in the browser. I am assuming this is because of the code <iframe>
What code do I need to put instead please to call the page links in the nav bar in the browser?
Can anyone help please
Thankyou in advance.
Lea
[edited by: tedster at 9:40 pm (utc) on Mar. 11, 2004]
[edit reason] use example.com [/edit]
this is on my main html page - hopefully calling the .php page I have loaded<iframe marginwidth="0" marginheight="0" width="468" height="30" scrolling="no" frameborder=0 src="http://www.example.com/navbar.php">
</iframe>
I think you're going about this the wrong way - you should really be including your menu directly into each page so it becomes an integral part of it, rather than using an iframe.
Try:
<?php include($_SERVER["DOCUMENT_ROOT"]."/path/to/menu.inc.php");?> In your file menu.inc.php you put the fragment of markup and/or php code you want on each page. Your pages will have to have the extension .php or, if they have the extension html, you need to have .html files parsed for php defined in your .htaccess file.
[edited by: tedster at 9:39 pm (utc) on Mar. 11, 2004]
[edit reason] use example.com [/edit]
what is the difference in what it does to the site
What I was doing, I am assuming, put the menu in the place I want it and meant I can change it accross all the pages.
What you are suggesting appears to do the same - but you mention includes? Is this for spidering or something?
lol - you would not think I had 60 sites! But mostly I write in raw html.
Thankyou
because its still opening in the nav frame - rather than opening in the page browser
see <Sorry, no personal URLs. See TOS [webmasterworld.com]> to see what i mean - top nav bar.
Lea
[edited by: tedster at 9:41 pm (utc) on Mar. 11, 2004]
Heres a slighty expanded example...
You want the same navbar on every page. In fact, the top html of your pages is probably the same on all pages. So you could stick this all in one file something like this...
/common/header.inc:
<html>
<head>
..usual stuff...
</head>
<body>
<div id="navbar">
..navbar links
</div>
..then your other files would include this file by doing this..
<?php include($_SERVER["DOCUMENT_ROOT"]."/common/header.inc");?>
..rest of the page..
</body>
</html>
See?
It's just using a tiny bit of php to include another file on all your pages. Now if you need to change the navbar you only need to change the header.inc file and every page will change.
Note: your pages should end in
php so that the server knows to process any php contained in them (e.g. they should be named index.php rather than index.html) Hope that helps.
Make a file, such as _nav-main.html.
Wherever you want the contents of that file, use
<!--#include virtual="_nav-main.html"-->
You can include a relative path, so if _nav-main is in the parent directory of where the current file is, you can use
<!--#include virtual="../_nav-main.html"-->
All you need is to rename your pages to *.shtml, if your server is setup correctly.
Also, I highly recommend that you use multi-views so file extensions are an internal detail instead of exposing your innards. Makes maintainence easier too.
I think I landed on the wrong planet.
Thankyou for all of that. Will have a play around with it all again and see what needs the least amount of work - you see that site is over 100 pages, and I was just going to change them gradually - I dont think that changing them to a .php is an option because of the amount of links from other sites I have already. - tho I suppose I can set up a forwarding url - ahhhh - my head hurts.
Thankyou again, sleeping now.
Lea
I dont think that changing them to a .php is an option because of the amount of links from other sites I have already.
Quite right - never change the file name unless absolutely forced to. However, you probably won't need to! Try adding this to a plain text file called .htaccess in your document root:
AddType application/x-httpd-php .html Change .html to .htm if that's the extension you're currently using. An important note - check to see whether an .htaccess file exists already before uploading a new one. If one exists, just add the above line to the other entries which exist already.