1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
|
<!doctype html public "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<title>WN Server Side Includes that Execute a Program</title>
<link rev="made" href="mailto:john@math.nwu.edu">
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="last-modified" content="Sun, 10 May 1998 18:07:18 GMT">
<meta http-equiv="keywords" content="WN clickable image example">
</head>
<body bgcolor="#FFFFFF">
<p>
<a href="http://hopf.math.nwu.edu/"><img
src="../images/powered.jpg"
border="0"
width="190"
height="41"
align="right"
alt="WN home page"
></a>
</p>
<strong>Version 2.0.0</strong>
<br>
<!-- pnuts --> <a href="index.html">[Up]</a> <a href="../index.html">[Top]</a>
<br clear="right">
<hr size="4">
<h2 align="center"><em>WN</em> Server Side Includes that Execute a
Program</h2>
<hr size="4">
<blockquote>
<p>
Is it possible to do a server-side include such as the following:
</p>
<blockquote>
<code>
<!-- #echo var="LAST_MODIFIED" -->
</code>
</blockquote>
<p>
I've tried it numerous ways and failed every time -- so I figured it
was time for a definitive answer. I can certainly live without them
but they would be nice to have.
</p>
</blockquote>
<h3>1 <a name="howto">How it Works</a></h3>
<p>
This is done with a server side include that executes a program. To see
this example in action try <a
href="index.html"><code>index.html</code></a>.
</p>
<p>
Here is an example of how to use scripts as server side includes. This
is not a <a href="http://hoohoo.ncsa.uiuc.edu/cgi/">CGI/1.1</a> program,
but something similar could be done with <a
href="http://hoohoo.ncsa.uiuc.edu/cgi/">CGI/1.1</a>. Assuming that the
program "<code><a href="#program">counter.cgi</a></code>" is in the same
directory as "<code>foo.html</code>" put something like:
</p>
<blockquote>
<code>
<a href="../appendixB.html#fdir.file">File=</a>foo.html
<br>
<a href="../appendixB.html#fdir.includes">Includes=</a>!counter.cgi
</code>
</blockquote>
<p>
in your <a href="../index_desc.html#index"><code>index</code></a> file.
Then put:
</p>
<blockquote>
<code>
<a href="../parse.html#including"><!-- #include --></a>
</code>
</blockquote>
<p>
on a line with no leading whitespace in the file <code>foo.html</code>.
The program <code>counter.cgi</code> gives the current count of accesses
to this page and also prints the last-modified date. It should be easy
to modify for your needs.
</p>
<p>
There are a couple of permissions issues. The user id under which the
server runs (e.g. "<code>nobody</code>") must have permission to execute
<code>counter.cgi</code> and to read and write the file
<code>/tmp/wncount</code>.
</p>
<h3>2 <a name="program">The Program <code>counter.cgi</code></a></h3>
<p>
Here is the <a href="http://www.perl.org">perl</a> program:
</p>
<blockquote>
<pre>
<!-- #include -->
</pre>
</blockquote>
<hr size="4">
<address>
<em>WN</em> version 2.0.0
<br>
Copyright © 1998 <a href="mailto:john@math.nwu.edu">John Franks
<john@math.nwu.edu></a>
<br>
licensed under the <a href="http://www.gnu.org/copyleft/gpl.html">GNU
General Public License</a>
<br>
last-modified: Sun, 10 May 1998 18:07:18 GMT
</address>
<!-- pnuts --><a href="index.html">[Up]</a> <a href="../index.html">[Top]</a>
</body>
</html>
|