l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2002 Feb 04 05:09

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] reading files into a web page
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] reading files into a web page

On Sat, 2002-02-02 at 03:14, Mark K. Kim wrote:
> SSI can do that, like this:
>    ...
>    <pre>
>       <!--#include virtual="/www/pcgm/bulletins" -->
>    </pre>
>    ...
> I *think* that's the right syntax.  It's been eons since I've used SSI.
> Depending on the host, you may need to name your file with a special
> extension, like ".phtml" or something.  Of course, the server needs to
> support SSI.

Also, e.g., for Apache, the configuration file usually isn't set up with
SSI on by default - you'll need to manually indicate what extension (or
if you don't like that, what specific filenames) will need to be parsed
by the server.

  AddType text/html .shtml
  AddHandler server-parsed .shtml

> Better way would be with PHP:
>    ...
>    <pre>
>       <?php
>          $fp = fopen("/www/pcgm/bulletins", "r");
>          fpassthru($fp);
>       ?>
>    </pre>
>    ...
> You'll most likely need to name the file with a special extension like
> ".php3" or ".php".  Of course, the server needs to support PHP for this to
> work.

Personally, I prefer the SSI method - likely to be more efficient, I
think.  Regardless of what method you use, you should still realize that
escaping needs to be performed for things like < and & to make "legal"
HTML (even though both Mozilla and Netscape 4.7 appear to handle
unencoded cases fine) - also some older browsers may have trouble with >
and " as well.

You could do this with something like:

  perl -e 'undef $/; $_ = <STDIN>; for $a
(["&","&amp;"],["<","&lt;"],[">","&gt;"],['"'\"'"',"&quot;"]) {
s/$a->[0]/$a->[1]/g; } print' < ~/test.html

which you could execute with <!--#exec cmd="..."-->, but that'll need
another level of quote escaping (which is already not too great - see
the entry for &quot; above).  My suggestion would be to perform the
escaping without the server beforehand, so that you can then just
include it.


vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Appahost Applications
For a significant contribution towards our projector, and a generous donation to allow us to continue meeting at the Davis Library.