The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

2 Pages V  1 2 >  
Reply to this topicStart new topic
> menu sidebar... separate code?
Locry
post Jan 28 2008, 07:51 PM
Post #1


Newbie
*

Group: Members
Posts: 14
Joined: 28-January 08
Member No.: 4,824



hello... i'm fairly new with web design... so i don't really know some of the terms yet, so please bear with me.

my site is http://www.milsimxgames.com

my dillema is this: the center portion of the page is the content area... the left side is the menu of sorts...while the right side is the "team" boards...

now throughout most of the pages the left and right sides remain constant in terms of their "contents/(elements?)"...
everytime i wish to add to an element to the left or right side i find myself having to edit all the pages just so the left and right menus stay consistent.

is there a way to reference "outside" the pages so that i only have to edit one file/code?

the page uses a downloaded template... i just modified the graphics and such... i know it uses a css file (slowly getting the hang of it )...

how do i go about referencing the file if ever?

thanks. smile.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Jan 28 2008, 07:56 PM
Post #2


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



Yes, but it must be done on the server (or before you upload the files). It can't be done with HTML. SSI is available on most servers and a nobraianer to use for this. Take a look at it.
http://htmlhelp.com/faq/html/design.html#include-file
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Locry
post Jan 28 2008, 08:01 PM
Post #3


Newbie
*

Group: Members
Posts: 14
Joined: 28-January 08
Member No.: 4,824



wow, thanks for the quick reply. smile.gif will check it out. thanks!
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Locry
post Jan 28 2008, 08:03 PM
Post #4


Newbie
*

Group: Members
Posts: 14
Joined: 28-January 08
Member No.: 4,824



hehehehe... i'm lost... i think i should just edit all the pages manually. smile.gif brute-force. smile.gif is this how some sites do it? brute-force i mean...
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post Jan 28 2008, 08:11 PM
Post #5


WDG Member
********

Group: Root Admin
Posts: 8,365
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



I set up an HTML preprocessor for my personal site when it expanded past a couple pages. It isn't that hard.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Locry
post Jan 28 2008, 08:13 PM
Post #6


Newbie
*

Group: Members
Posts: 14
Joined: 28-January 08
Member No.: 4,824



i'd have to look into this... i really am clueless at this point... i had programming experience with C and basic waaaaaaaay back, i'm familiar with functions and procedures... i just thought html would have a simple equivalent. smile.gif... if i don't get it i'll just limit my pages. smile.gif do a lot of cutting/pasting haha
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Jan 28 2008, 09:49 PM
Post #7


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



Come on... What don't you understand? Simply put SSI is a server mechanism that can replace "special tags" with something else. In your case that would be the content of a file.

Let's say you cut all the HTML for your menu out and put it in a file called menu.txt. Where the menu used to be you put the below SSS directive.

CODE
<!--#include virtual="/menu.txt" -->


When you go to the page with a browser the server will by pure magic replace the SSI directive with the content of menu.txt before it sends the page to the browser and the two are one again.

Now, does that sound like it's very hard to do? smile.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Alex McP
post Jan 29 2008, 01:15 PM
Post #8


Novice
**

Group: Members
Posts: 25
Joined: 24-January 08
Member No.: 4,787



QUOTE(pandy @ Jan 28 2008, 09:49 PM) *

Come on... What don't you understand? Simply put SSI is a server mechanism that can replace "special tags" with something else. In your case that would be the content of a file.

Let's say you cut all the HTML for your menu out and put it in a file called menu.txt. Where the menu used to be you put the below SSS directive.

CODE
<!--#include virtual="/menu.txt" -->


When you go to the page with a browser the server will by pure magic replace the SSI directive with the content of menu.txt before it sends the page to the browser and the two are one again.

Now, does that sound like it's very hard to do? smile.gif


I'll vouch for the ease of use: I asked this same question about a week ago, and now I'm up and running.

The operation is a "server side include". To do it I learned a bit (~30 minutes of reading) about PHP and spent 20 minutes in a text editor with my pages. It works great now, and already I've edited the "menu" file twice. It took 2 minutes each time, whereas before it would have taken me an hour to update each and every page.

It's worth the "hassle"!
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Dr Z
post Jan 29 2008, 09:21 PM
Post #9


Advanced Member
****

Group: Members
Posts: 221
Joined: 23-August 06
Member No.: 11



QUOTE(Darin McGrew @ Jan 28 2008, 05:11 PM) *

I set up an HTML preprocessor for my personal site when it expanded past a couple pages. It isn't that hard.


Darin,
Could you possible elaborate on the issue of HTML preprocessor?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post Jan 29 2008, 10:19 PM
Post #10


WDG Member
********

Group: Root Admin
Posts: 8,365
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



QUOTE
Could you possible elaborate on the issue of HTML preprocessor?
As the FAQ explains: "A preprocessor converts its source into a plain HTML document that you publish on your server. In contrast, documents that use server-side inclusion are processed every time the document is retrieved from the server."

We also have Links to HTML Preprocessors. I use HTMLPP (iMatix) for my personal site, but there are plenty to choose from.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Locry
post Jan 31 2008, 07:03 PM
Post #11


Newbie
*

Group: Members
Posts: 14
Joined: 28-January 08
Member No.: 4,824



QUOTE(pandy @ Jan 28 2008, 09:49 PM) *

Come on... What don't you understand? Simply put SSI is a server mechanism that can replace "special tags" with something else. In your case that would be the content of a file.

Let's say you cut all the HTML for your menu out and put it in a file called menu.txt. Where the menu used to be you put the below SSS directive.

CODE
<!--#include virtual="/menu.txt" -->


When you go to the page with a browser the server will by pure magic replace the SSI directive with the content of menu.txt before it sends the page to the browser and the two are one again.

Now, does that sound like it's very hard to do? smile.gif


wow! if you put it that way... it seems easy enough! smile.gif thanks! i think that's exactly what i'm after. smile.gif

so everything that is in the ".txt" file gets superimposed on the html file? including all the links and css pointers?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Locry
post Jan 31 2008, 07:08 PM
Post #12


Newbie
*

Group: Members
Posts: 14
Joined: 28-January 08
Member No.: 4,824



ok... so i included the directive... but nothing's happening... should i be doing something with the server? what in particular? sorry guys... i'm lost

update:

i read about ssi and shtml and that it has to be installed somehow... the problem is, i think i'm sharing space with other sites... (i'm new to this)... because when i access my control panel i see a bunch of other domains and their respective directories. i don't want to mess things up by inadvertently doing something that will affect the other sites... does installing something under my domain also affect the others? i'm just playing it safe at the moment. I do realize SSI is what i need... how do i go about installing it and where? thanks guys

This post has been edited by Locry: Jan 31 2008, 07:23 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Jan 31 2008, 07:24 PM
Post #13


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



QUOTE
wow! if you put it that way... it seems easy enough! smile.gif

I thought you would think so. biggrin.gif

QUOTE
so everything that is in the ".txt" file gets superimposed on the html file? including all the links and css pointers?

Yes. It doesn't matter where you cut (from this point of view). Think of it as cutting out a hole in a paper and then putting the piece you cut out back again with tape. It doesn't matter if you cut in the middle of a word or tag, but that may be stupid for other reasons. When you view source of a page with includes, you see no trace of them. There's just normal HTML.


QUOTE

ok... so i included the directive... but nothing's happening... should i be doing something with the server?


Yes, you should. I left that bit out. Wanted to get you hooked first. tongue.gif

First, SSI must be available. If you have a paid account it's rare it isn't. Second, the server must know which files to parse for SSI. Typically it parses all files with the extension .shtml. So you can try that to start with and see if something happens.

It can be impractical to rename all files, so there are ways to make the server parse .html files for SSI. If you are on Apache there are several ways. One is to add the below to an .htaccess file. But see if you can get it to work with the shtml extension first.

CODE
AddHandler server-parsed .html
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Locry
post Feb 2 2008, 05:04 AM
Post #14


Newbie
*

Group: Members
Posts: 14
Joined: 28-January 08
Member No.: 4,824



thank you so much bro! i'll try changing the html extension to shtml and see what happens. smile.gif

update: ok, so i included this line: <include virtual="/menu.txt">
where the menu.txt file is at the same level as the index.shtml... nothing happens... at least the code isn't "visible"... i guess it just doesn't see the .txt file?

This post has been edited by Locry: Feb 2 2008, 05:12 AM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Feb 2 2008, 02:55 PM
Post #15


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



The slash means the URL is relative to the document root. If you remove the slash it becomes relative the current document.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Feb 2 2008, 03:56 PM
Post #16


.
********

Group: WDG Moderators
Posts: 9,656
Joined: 10-August 06
Member No.: 7



<!--include virtual="/menu.txt"--> lacks the "#".

But the URL seems correct, since both files are in the web root.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Feb 2 2008, 04:18 PM
Post #17


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



Darn, I didn't see that. Where is the .shtml file then?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Feb 2 2008, 04:20 PM
Post #18


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



Oh. It's the index file. blush.gif

You should also have a space before the closing '--'.

Not so
CODE
<!--include virtual="/menu.txt"-->

but so
CODE
<!--#include virtual="/menu.txt" -->
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Feb 2 2008, 05:03 PM
Post #19


.
********

Group: WDG Moderators
Posts: 9,656
Joined: 10-August 06
Member No.: 7



Actually, before you start changing all your file names to .shtml, consider using PHP includes instead of SSI (if your web host supports it). PHP includes work the same way as in SSI (syntax is slightly different):

CODE
<?php include '/menu.txt'; ?>


but PHP is far more powerful than SSI, something that you'll appreciate sooner or later. Just like SSI you can configure PHP to use any file extension you like, so you don't have to use .php.

The PHP manual is very good: http://php.net/
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Feb 2 2008, 05:09 PM
Post #20


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



Hey, it's one step at the time here. tongue.gif Besides, if you don't change the file names it doesn't matter what you use to start with.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

2 Pages V  1 2 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 24th April 2024 - 09:21 PM