Another annoying web design question

Posted by: Dignan

Another annoying web design question - 18/03/2002 12:10

Yet again, I have a little challenge.

As you may have seen, I don't like frames. I like having only one page on screen. For this reason I end up wanting to do things that would be quite simple with frames and needlessly hard without

redbutt2's help with my college band's page was fantastic. it was exactly what I needed. So here's another one for him or anyone to answer. I'm not sure if this is possible anyway.

Say I have a menu. From time to time the menu might change. If that menu is on all of my pages, changing one link would require editing every instance of it on each menu. Or maybe I want to add a section to the site. Same thing.

Is there an easier way? Can something like this be simplified? CSS makes stuff like this easy by providing one file to control all attributes. Is there a way to load HTML into a page from an external location? (this is where I start talking about stuff I know nothing about, this is all stuff I'm dreaming up ).

I hope I'm making this clear. I'll try to clear up the confusion if there is any.

Thanks.
Posted by: ninti

Re: Another annoying web design question - 18/03/2002 12:19

If your server is ASP capable, change the extension of all the pages to pagename.asp and add a line in them:
<!--#include file="PieceofWebsite.inc"-->
and put all the menu code in that file. Changing the extension won't affect the pages in any other way.

If you are using Dreamweaver to create your pages, they have something called templates where you can edit the template and every page that uses that template will get changed automatically.
Posted by: tfabris

Re: Another annoying web design question - 18/03/2002 12:22

Yes, there are a couple of ways to go about it. You're essentially talking about an "include" or something that behaves like an include.

Which way you choose to do it will depend upon how compatible you want the site to be. There are ways to do it in the page code if your users have a recent browser.

But if you want it to be compatible with all broswers including very old ones, then you have to do it all server-side. The www.riocar.org site is an example of this. Its left-hand navigation menu can be easily updated without having to make a change to all of the pages. There is a piece of software running on the web server (in this case, PHPNuke) which handles all of the updates to the left-hand navigation bar.
Posted by: tfabris

Re: Another annoying web design question - 18/03/2002 12:24

Right, ASP is another example of how to do it server-side. But the server has to be running the Microsoft ASP server software in order for it to work.
Posted by: drakino

Re: Another annoying web design question - 18/03/2002 12:48

Almost every server running Apache supports "Server Side Includes" or SSI for short. For a basic menu, this is the easiest. And of course, almost every IIS supports ASP, so you have a way to go no matter what the host runs. It can be done in PHP as well, but for a basic menu, look at SSI.
Posted by: tfabris

Re: Another annoying web design question - 18/03/2002 15:18

The trick, I'm sure, is that the syntax is different, depending on which piece of server software you're running.
Posted by: redbutt2

Re: Another annoying web design question - 18/03/2002 15:34

Without having read the rest of this...AHHH NOOOO...don't use ASP...use PHP, Server Side Includes, or a cgi. Stay away from ASP.

Now I'll keep reading.
Posted by: redbutt2

Re: Another annoying web design question - 18/03/2002 15:39

O.K. So, yes this is server dependant, but like was mentioned before, the chances of your server NOT supporting SSI are real slim, so try this first.

Make a new page with just the HTML/code for the menu. Now on all the pages that you want to put that menu on add a line like this in the spot the menu would sit...

<!--#include file="included.html" -->

Then save the page with the extension ".shtml". It won't work if you don't change the extension. That should do it.
Posted by: ninti

Re: Another annoying web design question - 18/03/2002 16:27

> NOOOO...don't use ASP

My apologies for offering a Microsoft solution. I forget where I was.
Posted by: justinlarsen

Re: Another annoying web design question - 18/03/2002 16:58

***slaps your rist***
Posted by: Dignan

Re: Another annoying web design question - 18/03/2002 23:19

Yet again, I am amazed by the response. Thank you all so much. When I actually get some free time, I'll apply this to my web pages. So cool. So very cool.

Posted by: peter

Re: Another annoying web design question - 19/03/2002 09:26

Then save the page with the extension ".shtml". It won't work if you don't change the extension.

Doesn't Apache also have a kludge to enable SSI if the html file has the x bit set? or did I dream that bit?

That'd be helpful if your pages have been around for a while (i.e. if people may already have links to the .html filenames).

Peter
Posted by: mtempsch

Re: Another annoying web design question - 19/03/2002 09:37

Don't know about the execute bit, but you can (could?) set Apache to check all files for SSI, decreases performance though...

/Michael
Posted by: Dignan

Re: Another annoying web design question - 20/03/2002 00:26

I have a question about this. What do I do about the index page? I tried it out and the file "index.shtml" isn't recognized the same way that "index.html" is. Is there some way around this, or am I going to have to be content editing two pages whenever I want to change the menu around?
Posted by: johnmcd3

Re: Another annoying web design question - 20/03/2002 01:53

Somewhere in the configuration of your server you can set the order of files it looks for as a default display. Yours obviously has "index.html" and probably others ("index.htm"). In IIS (sorry, no experience w/ apache) it's under a tab in site properties or something like that. Add "index.shtml" to that.

Alternatively, as mentioned above you could enable your server software to check html files for SSI.
Posted by: Roger

Re: Another annoying web design question - 20/03/2002 04:02

In Apache, set DirectoryIndex
Posted by: wfaulk

Re: Another annoying web design question - 20/03/2002 13:38

XBitHack
Posted by: Dignan

Re: Another annoying web design question - 20/03/2002 16:51

I have no idea what that page is about

I appreciate the help, but these suggests are made under the assumption that I can get someone to change/have access to the server. I'm at school right now. They are quite paranoid about their servers. They wouldn't let me change permissions for the server user on an organization web site so I could use the Gallery software.

So basically, is there anything I can do myself to fix it, short of an index page that forwards to the .shtml page?
Posted by: tfabris

Re: Another annoying web design question - 20/03/2002 16:53

I appreciate the help, but these suggests are made under the assumption that I can get someone to change/have access to the server.

Not necessarily. Maybe you merely need to try the syntax of a server-side-include and it might just work. It's possible (likely, even) that your server operator has enabled server-side-includes and there's no problem.
Posted by: guardian__J

Re: Another annoying web design question - 20/03/2002 16:58

so you have no way at all to change the default page for a directory?
I think that the admins would probaly do this for you, it is a pretty basic and common function that needs to be set for different sites, so they may be willing if you ask them.
Posted by: charcoalgray99

Re: Another annoying web design question - 20/03/2002 17:11

I'm not an apache expert, but can't he just drop a .htaccess file in his directory with a DirectoryIndex line? I don't think any settings or permission changes are needed.

Tom
Posted by: wfaulk

Re: Another annoying web design question - 20/03/2002 20:46

You can enable and disable .htaccess files within the main Apache config. It's worth a shot, but I wouldn't be surprised if it didn't work, or only worked for a small set of config options.