PDA

View Full Version : Stupid Newbie Question (sorry)



NoNameFace72
01-14-2004, 07:01 PM
Hi all, sorry to bother you with this, since its something that i *should* be able to find on google but havent been able to.

Is there anything other than frames that I can use to have my navigation bar be a seperate file from my webpages, but have it display in the same place on each of the pages. I want to do this so that my pages are easier to maintain and I dont have to change everypage. Using frames is just kindof...icky it doesnt really look good at all IMO, so is there anything else?

Shawn
01-14-2004, 07:11 PM
That is a really stupid question. Kidding.

Frames aren't attractive, nor are they good for search engine optimization. An easy way to have a dynamic page with regular, static files:

1. Create a file called navigation.inc in the directory where your website pages are (create a text file and rename it to navigation.inc).

2. Take all the code from your webpage that you want to be easily changable and place it into the navigation.inc file. In this case, it'd be the navigation info.

3. In place of the code that you took from your webpage, replace it with the following: <?php include("navigation.inc"); ?>

Assuming several variables are right, this should work. Whenever you want to update navigation, simply edit the navigation.inc file. Let me know if this works.

NoNameFace72
01-14-2004, 07:17 PM
Thanks, I'll try testing it out here in a second

NoNameFace72
01-14-2004, 07:25 PM
What variables need to be "right", i just tried this with a dummy page so i dont accidentally kill the page I have up right now and it didnt work.

Shawn
01-14-2004, 07:28 PM
Let me see the page. What's the link?

NoNameFace72
01-14-2004, 07:34 PM
I took the dummy page down, but the page i want to do it to is:

www.greymatter.tk
....or....
www.freewebs.com/nonameface72/

I'm not sure if the cloaking w/ my .tk address matters or not so i gave both...

Shawn
01-14-2004, 07:46 PM
Well, I need the dummy page to see the error.

Quick questions: Do you have PHP on your server? If you're not sure, can you send me the URL of your host?

NoNameFace72
01-14-2004, 07:50 PM
I'm not completely sure, its www.freewebs.com

The dummy page i made on my hard drive...thats probly the problem now that i think about it, but ill upload it to check.

NoNameFace72
01-14-2004, 07:56 PM
Dummy page = www.freewebs.com/nonameface72/dummy.html
.INC file = www.freewebs.com/nonameface72/navigation.inc

NoNameFace72
01-14-2004, 07:59 PM
Looks like they dont support php...anything else that i could use? or should i switch to a different server?

Chris
01-14-2004, 07:59 PM
You shouldn't name includes with any code in them with any extension other than that code's extension (like php) unless you place it in a folder above your root web folder.

Otherwise someone could access the file directly, and since it has the wrong extension it wouldn't be parsed for code, so the person could view you db passwords or whatever else you keep in there.

MattM
01-14-2004, 08:06 PM
You could use SSI instead if they don't support PHP.

Shawn
01-14-2004, 08:08 PM
Of course that's the case Chris, but he's not using the file to keep db passwords. I don't think the navigation code is that important.

NoNameFace72
01-14-2004, 08:08 PM
I finally found something on google, searching under php includes. It uses SSI instead of php but it works:

www.freewebs.com/nonameface72/dummy.shtml

so what would i change the .inc to for it to still work with the ssi? to .ssi or to .shtml like the dummy page?

Chris
01-14-2004, 09:35 PM
the include file can be named anything with SSI. The important thing is that the including file have a .shtml extension.

NoNameFace72
01-15-2004, 05:27 PM
Thanks for your help last night guys, i went to bed right after my last post so i didnt gat a chance to say thanks. Later then.