[Javascript] Javascript to change include filename

Del Wegener del at delweg.com
Sat Jan 24 12:26:40 CST 2009


----- Original Message ----- 
From: "tedd" <tedd at sperling.com>
To: "JavaScript List" <javascript at lists.evolt.org>
Cc: "Del Wegener" <del at delweg.com>
Sent: Saturday, January 24, 2009 11:52 AM
Subject: Re: [Javascript] Javascript to change include filename


> At 10:42 AM -0600 1/24/09, Del Wegener wrote:
>>>Del:
>>>
>>>I brought this discussion back to this list so that others may benefit.
>>>
>>>All your questions will be answered IF you fully follow my write-up here:
>>>
>>>http://sperling.com/examples/include-demo/
>>>
>>>Welcome to the wonderful world of includes -- your world is about to 
>>>change.
>>>
>>>Cheers,
>>>
>>>tedd
>>>
>>I have had a chance to read your (and other) discussion.  I have used 
>>shtml includes in the past but PHP includes seem much better, cleaner, and 
>>more secure.  So I am switching over to PHP includes for the site I am 
>>working on.  Furthermore I intend to make my header and footer files more 
>>inclusive (as you suggest) than in the past.  With at least two embedded 
>>include statements in the header include.
>>
>>Thanks a heap.
>>
>>Del
>
> Del:
>
> The number of "includes" you have in any one file really doesn't mean 
> anything.

It indicates the amount of redundant code on the pages of this site.

>
> You should always use "includes" to consolidate redundant code into a 
> single file. For example, if your site has a navigation menu that is 
> common to all pages, then make it a single file and include it once in 
> each page. That way when you make a change to your menu, it's reflected on 
> every page that uses that include.
>
> This is just a technique that provides for easier organization, 
> maintenance, and distribution of code.
>
> Good luck,
>
> tedd
>
That is exactly what I plan to do.
I have a header which is common to all but the home page.  This header 
contains a complex CSS menu which is on the homepage -- by virtue of an 
include statement.
A footer which is common to all pages.
In the past I have handled these "common" items with frames, or library 
items (in DreamWeaver), or SHTML includes of text files.

It just seems to me after seeing your essay and examples that all of this 
and more can be done very nicely with PHP.  Since my task is to redo this 
old frame based site from scratch, I may as well jump as far forward as I 
can.  The owners want it to look new and fresh until they retire and shut 
down the company! 





More information about the Javascript mailing list