/    Sign up×
Community /Pin to ProfileBookmark

Need clarification

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 Advance

to post a comment
CSS

13 Comments(s)

Copy linkTweet thisAlerts:
@BonRougeApr 12.2005 — To 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.
Copy linkTweet thisAlerts:
@dragonfighter60authorApr 12.2005 — 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?
Copy linkTweet thisAlerts:
@BonRougeApr 12.2005 — 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 :[code=php]<?php include("menu.php"); ?>[/code]
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.
Copy linkTweet thisAlerts:
@dragonfighter60authorApr 12.2005 — 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.
Copy linkTweet thisAlerts:
@MstrBobApr 12.2005 — The menu doesn't have to be PHP, the file with the include statement needs to be php. So, you'd have blargh.[B]php[/B]

[code=php]
<?PHP include('menu.txt'); ?>
[/code]


I'd recommend you rename menu.php to menu.txt so as to cut server strain.
Copy linkTweet thisAlerts:
@BonRougeApr 12.2005 — 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.
Copy linkTweet thisAlerts:
@dragonfighter60authorApr 12.2005 — 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.
Copy linkTweet thisAlerts:
@BonRougeApr 12.2005 — 
Then save your page with a .php extension.
[/QUOTE]

So yeah, as I said before and as MstrBob said, you need to save the page as 'blargh.php'.
Copy linkTweet thisAlerts:
@dragonfighter60authorApr 12.2005 — 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.
Copy linkTweet thisAlerts:
@BonRougeApr 12.2005 — 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.[/QUOTE]

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.
Copy linkTweet thisAlerts:
@BonRougeApr 12.2005 — 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.?[/QUOTE]
no
Copy linkTweet thisAlerts:
@dragonfighter60authorApr 12.2005 — WOO. 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.
Copy linkTweet thisAlerts:
@BonRougeApr 12.2005 — 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 : http://bonrouge.com/br.php?page=faq (this is a link to one of my pages).

[URL=http://www.alistapart.com/articles/phpcms/]Here's an article about it on A List Apart[/URL]. It's a pretty simple idea and very useful. After that, there are just a few small security questions.
×

Success!

Help @dragonfighter60 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...