Re: OT--HTML coding question

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
+ (text/plain)
Delete this message
Reply to this message
Author: Phillip Waclawski
Date:  
To: m jarvis, Main PLUG discussion list
Subject: Re: OT--HTML coding question
If your server supports php, just rename the file to whatever.php and put this

<?php
include 'filenametobepasted';
?>

Phil W.

----- Original Message -----

From: "Mark Jarvis" <>
To: "Main PLUG discussion list" <>
Sent: Sunday, February 26, 2012 10:33:27 PM
Subject: Re: OT--HTML coding question


Thanks! It sounds like a good solution. If this was a commercial web site I'd probably do it. However this is something I'm doing on a volunteer basis using donated space and I'm trying to keep everything small and simple--especially simple.

Once again, thanks!

Mark

Matt Graham wrote:

From: Mark Jarvis <>
<blockquote>
I have a web site with a large number of hand coded pages. I have a
block of code that needs to be inserted into each page. The problem is
that the block will change occasionally as new material is added.
Obviously, things would be much simpler if I could make the change in
one place and have each page attach/include/link to/etc. a file
containing that piece of code. If there is an HTML construct that allows
that, I haven't found it.

It's called "server-side includes", and it's relatively standard if you're
using Apache. You have to have the directory you want to have server-side
includes enabled in with a config stanza kind of like so:

<Directory "/var/www/localhost/htdocs">
Options Indexes FollowSymLinks Includes
</Directory>
# note that Includes is the option you want to have enabled for this dir.
# that's the docroot of my webhost; modify for your setup
# make sure to restart apache if you change the config file

Once this has been done, all you have to do is to put a construct like so into
foobar.html:

<!--#include virtual="/incs/nav.html" -->

...this tells apache that when it's reading foobar.html, it should read the
file /var/www/localhost/htdocs/incs/nav.html and insert that file's contents
into foobar.html at that point, before sending stuff to the client.[0] This
is *really* useful. At work, we basically depend on apache SSI to do 5 tons
of stuff, since many pages use the same stuff across the whole site for
navigation/menu bars/whatever.

If this didn't make any sense, holler.

[0] It can get a bit more complex than that, what with RewriteRules and other
stuff, but that'll get you started.
</blockquote>

---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss