Need clarification

windows

Guest
Can I, with CSS, make a navigational menu (for example the one on my site) and then have every site access it individually or is it better just to put the whole table in each HTML page?

Also, Is it possible to tell it from an external css sheet " I want navigational menu here, these buttons here, the boder here, and the background this color." ?

I am trying to learn as I go. If these things are possible, would you please tell me how to do it or direct me to a resource? I tried searching on the site but I may be searching for the wrong things.

Thanks in AdvanceTo have the same menu on each page you can use php includes.
To have the menu look the same on each page, you can use an external style sheet.So, to use php includes, do I need to make a page specifically devoted to my navigational menu? Then, would I place it with div commands on the page or the external style sheet, or what?You need to check that your server supports php. Most do.
Then you take your menu - only the menu (no body tags, DTD,etc) and save it to a file. It's a good idea to save it with a .php extension. say 'menu.php'
Then, where you would normally put your menu on your page, put this :<?php include("menu.php"); ?>
Then save your page with a .php extension.
Put that line on any page where you want the menu.
CSS is about style, so by linking the same .css file to every page with the menu, the menu will look the same on every page.ok, i made a test page called blargh.html and i put my menu table in a file named "menu.php".

what i basically did was copy my index.html and renamed it so i could modify it. then i deleted the menu table and in its place i put the php text you gave me. that didnt work.

SO, i ask now, will div commands for something else interfere with the php include? I have my border set with a div command and i had the menu set with a div command.

I tried setting the php with a div command as well.

BTW, I used the code off of html goodies to do the php test and it worked. I knew it did before but i did it just to make sure. So i know the server supports it.The menu doesn't have to be PHP, the file with the include statement needs to be php. So, you'd have blargh.php


<?PHP include('menu.txt'); ?>


I'd recommend you rename menu.php to menu.txt so as to cut server strain.My thinking was that you might want to have some php in the menu itself sometime in the future - maybe to show which page is the current one. You might as well call it "menu.php" now so that you don't have to go changing your links in the future.Ok, so 1. I have to change all of my site parts to a .php extension to make this work on all pages?
2. Why does it strain the server is both the .txt and .php files are exactly the same size?

But the above does work thank you.Then save your page with a .php extension.

So yeah, as I said before and as MstrBob said, you need to save the page as 'blargh.php'.Argh, i missed that. Sorry for causing that bit of trouble. Looks like I'll be converting my pages to .php.... that wont mess with anything will it? Css, javascript, etc.?

edit: btw, a moderator may want to move this to the php forum considering thats what the discussion went to. I put it here because i thought it would be a css discussion.Ok, so 1. I have to change all of my site parts to a .php extension to make this work on all pages?
2. Why does it strain the server is both the .txt and .php files are exactly the same size?

But the above does work thank you.
1. Yes - every page that has some php in it has to have a .php extension.
2. The .php extension tells the server that that file has some php in it and so it has some work to do - i.e., in this case, it has to take the text from one file and put it into that page. If the file has a different extension - you have a few choices (.htm, .html, .txt) - then it doesn't have to worry, so you'll save a microsecond of server processing time.Argh, i missed that. Sorry for causing that bit of trouble. Looks like I'll be converting my pages to .php.... that wont mess with anything will it? Css, javascript, etc.?
noWOO. Thanks. I'm in the process of converting now. I thank you guys for all the help on this and dealing with my lack of knowledge.

I don't like how my site was set up before .... tables everywhere. even "spacer tables" with "space.gif" <--actual name of one of the blank gifs on the site.I've since taken over the site and am trying to modernize and clean up the site.Have you thought about using a php template? You have one basic page (with your head, menu, and basic structure) and you save the different parts - the content of the pages - in different files just like you've done with your menu there. Then each 'page' is called in by a variable in the url - you must have seen urls like this : <!-- m --><a class="postlink" href="http://bonrouge.com/br.php?page=faq">http://bonrouge.com/br.php?page=faq</a><!-- m --> (this is a link to one of my pages).

Here's an article about it on A List Apart (<!-- m --><a class="postlink" href="http://www.alistapart.com/articles/phpcms/">http://www.alistapart.com/articles/phpcms/</a><!-- m -->). It's a pretty simple idea and very useful. After that, there are just a few small security questions.
 
Back
Top