]> granicus.if.org Git - apache/blob - docs/manual/mod/mod_imagemap.xml
Break <highlight language="commit">foo</highlight> into separate lines.
[apache] / docs / manual / mod / mod_imagemap.xml
1 <?xml version="1.0"?>
2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- $LastChangedRevision$ -->
5
6 <!--
7  Licensed to the Apache Software Foundation (ASF) under one or more
8  contributor license agreements.  See the NOTICE file distributed with
9  this work for additional information regarding copyright ownership.
10  The ASF licenses this file to You under the Apache License, Version 2.0
11  (the "License"); you may not use this file except in compliance with
12  the License.  You may obtain a copy of the License at
13
14      http://www.apache.org/licenses/LICENSE-2.0
15
16  Unless required by applicable law or agreed to in writing, software
17  distributed under the License is distributed on an "AS IS" BASIS,
18  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  See the License for the specific language governing permissions and
20  limitations under the License.
21 -->
22
23 <modulesynopsis metafile="mod_imagemap.xml.meta">
24
25 <name>mod_imagemap</name>
26 <description>Server-side imagemap processing</description>
27 <status>Base</status>
28 <sourcefile>mod_imagemap.c</sourcefile>
29 <identifier>imagemap_module</identifier>
30
31 <summary>
32     <p>This module processes <code>.map</code> files, thereby
33     replacing the functionality of the <code>imagemap</code> CGI
34     program. Any directory or document type configured to use the
35     handler <code>imap-file</code> (using either
36     <directive module="mod_mime">AddHandler</directive> or
37     <directive module="core">SetHandler</directive>)
38     will be processed by this module.</p>
39
40     <p>The following directive will activate files ending with
41     <code>.map</code> as imagemap files:</p>
42
43     <highlight language="config">
44 AddHandler imap-file map
45     </highlight>
46
47     <p>Note that the following is still supported:</p>
48
49     <highlight language="config">
50 AddType application/x-httpd-imap map
51     </highlight>
52
53     <p>However, we are trying to phase out "magic MIME types" so we
54     are deprecating this method.</p>
55 </summary>
56
57 <section id="features"><title>New Features</title>
58
59     <p>The imagemap module adds some new features that were not
60     possible with previously distributed imagemap programs.</p>
61
62     <ul>
63       <li>URL references relative to the Referer: information.</li>
64
65       <li>Default <code>&lt;base&gt;</code> assignment through a new map
66       directive <code>base</code>.</li>
67
68       <li>No need for <code>imagemap.conf</code> file.</li>
69
70       <li>Point references.</li>
71
72       <li>Configurable generation of imagemap menus.</li>
73     </ul>
74 </section>
75
76 <section id="imapfile"><title>Imagemap File</title>
77
78     <p>The lines in the imagemap files can have one of several
79     formats:</p>
80
81     <example>
82       directive value [<var>x</var>,<var>y</var> ...]<br />
83       directive value "<var>Menu text</var>" [<var>x</var>,<var>y</var>
84       ...]<br />
85       directive value <var>x</var>,<var>y</var> ... "<var>Menu text</var>"
86     </example>
87
88     <p>The directive is one of <code>base</code>,
89     <code>default</code>, <code>poly</code>, <code>circle</code>,
90     <code>rect</code>, or <code>point</code>. The value is an
91     absolute or relative URL, or one of the special values listed
92     below. The coordinates are <code><var>x</var>,<var>y</var></code>
93     pairs separated by whitespace. The quoted text is used as the text of
94     the link if a imagemap menu is generated. Lines beginning with '#' are
95     comments.</p>
96
97     <section id="imapfile.directives"><title>Imagemap File Directives</title>
98       <p>There are six directives allowed in the imagemap file. The
99       directives can come in any order, but are processed in the
100       order they are found in the imagemap file.</p>
101
102       <dl>
103       <dt><code>base</code> Directive</dt>
104
105       <dd><p>Has the effect of <code>&lt;base href="<var>value</var>"&gt;
106       </code>. The non-absolute URLs of the map-file are taken relative
107       to this value. The <code>base</code> directive overrides
108       <directive module="mod_imagemap">ImapBase</directive> as set in a
109       <code>.htaccess</code> file or in the server configuration files.
110       In the absence of an <directive>ImapBase</directive> configuration
111       directive, <code>base</code> defaults to
112       <code>http://server_name/</code>.</p>
113       <p><code>base_uri</code> is synonymous with <code>base</code>.
114       Note that a trailing slash on the URL is significant.</p></dd>
115
116       <dt><code>default</code> Directive</dt>
117
118       <dd>The action taken if the coordinates given do not fit any
119       of the <code>poly</code>, <code>circle</code> or
120       <code>rect</code> directives, and there are no
121       <code>point</code> directives. Defaults to <code>nocontent</code>
122       in the absence of an <directive module="mod_imagemap"
123       >ImapDefault</directive> configuration setting, causing a status
124       code of <code>204 No Content</code> to be returned. The client
125       should keep the same page displayed.</dd>
126
127       <dt><code>poly</code> Directive</dt>
128
129       <dd>Takes three to one-hundred points, and is obeyed if the
130       user selected coordinates fall within the polygon defined by
131       these points.</dd>
132
133       <dt><code>circle</code></dt>
134
135       <dd>Takes the center coordinates of a circle and a point on
136       the circle. Is obeyed if the user selected point is with the
137       circle.</dd>
138
139       <dt><code>rect</code> Directive</dt>
140
141       <dd>Takes the coordinates of two opposing corners of a
142       rectangle. Obeyed if the point selected is within this
143       rectangle.</dd>
144
145       <dt><code>point</code> Directive</dt>
146
147       <dd>Takes a single point. The point directive closest to the
148       user selected point is obeyed if no other directives are
149       satisfied. Note that <code>default</code> will not be
150       followed if a <code>point</code> directive is present and
151       valid coordinates are given.</dd>
152       </dl>
153     </section>
154
155     <section id="imapfile.values"><title>Values</title>
156
157       <p>The values for each of the directives can be any of the
158       following:</p>
159
160       <dl>
161       <dt>a URL</dt>
162
163       <dd><p>The URL can be relative or absolute URL. Relative URLs
164       can contain '..' syntax and will be resolved relative to the
165       <code>base</code> value.</p>
166       <p><code>base</code> itself will not be resolved according to the
167       current value. A statement <code>base mailto:</code> will
168       work properly, though.</p></dd>
169
170       <dt><code>map</code></dt>
171
172       <dd>Equivalent to the URL of the imagemap file itself. No
173       coordinates are sent with this, so a menu will be generated
174       unless <directive module="mod_imagemap">ImapMenu</directive> is set to
175       <code>none</code>.</dd>
176
177       <dt><code>menu</code></dt>
178       <dd>Synonymous with <code>map</code>.</dd>
179
180       <dt><code>referer</code></dt>
181
182       <dd>Equivalent to the URL of the referring document. Defaults
183       to <code>http://servername/</code> if no <code>Referer:</code>
184       header was present.</dd>
185
186       <dt><code>nocontent</code></dt>
187
188       <dd>Sends a status code of <code>204 No Content</code>,
189       telling the client to keep the same page displayed. Valid for
190       all but <code>base</code>.</dd>
191
192       <dt><code>error</code></dt>
193
194       <dd>Fails with a <code>500 Server Error</code>. Valid for all
195       but <code>base</code>, but sort of silly for anything but
196       <code>default</code>.</dd>
197       </dl>
198     </section>
199
200     <section id="imapfile.coords"><title>Coordinates</title>
201
202       <dl>
203       <dt><code>0,0 200,200</code></dt>
204
205       <dd>A coordinate consists of an <var>x</var> and a <var>y</var>
206       value separated by a comma. The coordinates are separated
207       from each other by whitespace. To accommodate the way Lynx
208       handles imagemaps, should a user select the coordinate
209       <code>0,0</code>, it is as if no coordinate had been
210       selected.</dd>
211       </dl>
212
213     </section>
214
215     <section id="imapfile.quotedtext"><title>Quoted Text</title>
216
217       <dl>
218       <dt><code>"<var>Menu Text</var>"</code></dt>
219
220       <dd><p>After the value or after the coordinates, the line
221       optionally may contain text within double quotes. This string
222       is used as the text for the link if a menu is
223       generated:</p>
224
225       <example>
226         &lt;a href="http://example.com/"&gt;<var>Menu text</var>&lt;/a&gt;
227       </example>
228
229       <p>If no quoted text is present, the name of the link will be
230       used as the text:</p>
231
232       <example>
233         &lt;a href="http://example.com/"&gt;http://example.com&lt;/a&gt;
234       </example>
235
236       <p>If you want to use double quotes within this text, you have to
237       write them as <code>&amp;quot;</code>.</p></dd>
238       </dl>
239
240     </section>
241 </section>
242
243 <section id="example"><title>Example Mapfile</title>
244
245     <example>
246       #Comments are printed in a 'formatted' or 'semiformatted' menu.<br />
247       #And can contain html tags. &lt;hr&gt;<br />
248       base referer<br />
249       poly map "Could I have a menu, please?" 0,0 0,10 10,10 10,0<br />
250       rect .. 0,0 77,27 "the directory of the referer"<br />
251       circle http://www.inetnebr.example.com/lincoln/feedback/ 195,0 305,27<br />
252       rect another_file "in same directory as referer" 306,0 419,27<br />
253       point http://www.zyzzyva.example.com/ 100,100<br />
254       point http://www.tripod.example.com/ 200,200<br />
255       rect mailto:nate@tripod.example.com 100,150 200,0 "Bugs?"<br />
256     </example>
257
258 </section>
259
260 <section id="referencing"><title>Referencing your mapfile</title>
261
262     <example><title>HTML example</title>
263       &lt;a href="/maps/imagemap1.map"&gt;<br />
264       <indent>
265         &lt;img ismap src="/images/imagemap1.gif"&gt;<br />
266       </indent>
267       &lt;/a&gt;
268     </example>
269
270     <example><title>XHTML example</title>
271       &lt;a href="/maps/imagemap1.map"&gt;<br />
272       <indent>
273         &lt;img ismap="ismap" src="/images/imagemap1.gif" /&gt;<br />
274       </indent>
275       &lt;/a&gt;
276     </example>
277
278 </section>
279
280 <directivesynopsis>
281 <name>ImapMenu</name>
282 <description>Action if no coordinates are given when calling
283 an imagemap</description>
284 <syntax>ImapMenu none|formatted|semiformatted|unformatted</syntax>
285 <default>ImapMenu formatted</default>
286 <contextlist><context>server config</context><context>virtual host</context>
287 <context>directory</context><context>.htaccess</context></contextlist>
288 <override>Indexes</override>
289
290 <usage>
291     <p>The <directive>ImapMenu</directive> directive determines the
292     action taken if an imagemap file is called without valid
293     coordinates.</p>
294
295     <dl>
296       <dt><code>none</code></dt>
297       <dd>If ImapMenu is <code>none</code>, no menu is generated,
298       and the <code>default</code> action is performed.</dd>
299
300       <dt><code>formatted</code></dt>
301       <dd>A <code>formatted</code> menu is the simplest menu.
302       Comments in the imagemap file are ignored. A level one header
303       is printed, then an hrule, then the links each on a separate
304       line. The menu has a consistent, plain look close to that of
305       a directory listing.</dd>
306
307       <dt><code>semiformatted</code></dt>
308       <dd>In the <code>semiformatted</code> menu, comments are
309       printed where they occur in the imagemap file. Blank lines
310       are turned into HTML breaks. No header or hrule is printed,
311       but otherwise the menu is the same as a
312       <code>formatted</code> menu.</dd>
313
314       <dt><code>unformatted</code></dt>
315       <dd>Comments are printed, blank lines are ignored. Nothing is
316       printed that does not appear in the imagemap file. All breaks
317       and headers must be included as comments in the imagemap
318       file. This gives you the most flexibility over the appearance
319       of your menus, but requires you to treat your map files as
320       HTML instead of plaintext.</dd>
321     </dl>
322 </usage>
323 </directivesynopsis>
324
325 <directivesynopsis>
326 <name>ImapDefault</name>
327 <description>Default action when an imagemap is called with coordinates
328 that are not explicitly mapped</description>
329 <syntax>ImapDefault error|nocontent|map|referer|<var>URL</var></syntax>
330 <default>ImapDefault nocontent</default>
331 <contextlist><context>server config</context><context>virtual host</context>
332 <context>directory</context><context>.htaccess</context></contextlist>
333 <override>Indexes</override>
334
335 <usage>
336     <p>The <directive>ImapDefault</directive> directive sets the default
337     <code>default</code> used in the imagemap files. Its value is
338     overridden by a <code>default</code> directive within the
339     imagemap file. If not present, the <code>default</code> action
340     is <code>nocontent</code>, which means that a <code>204 No
341     Content</code> is sent to the client. In this case, the client
342     should continue to display the original page.</p>
343 </usage>
344 </directivesynopsis>
345
346 <directivesynopsis>
347 <name>ImapBase</name>
348 <description>Default <code>base</code> for imagemap files</description>
349 <syntax>ImapBase map|referer|<var>URL</var></syntax>
350 <default>ImapBase http://servername/</default>
351 <contextlist><context>server config</context><context>virtual host</context>
352 <context>directory</context><context>.htaccess</context></contextlist>
353 <override>Indexes</override>
354
355 <usage>
356     <p>The <directive>ImapBase</directive> directive sets the default
357     <code>base</code> used in the imagemap files. Its value is
358     overridden by a <code>base</code> directive within the imagemap
359     file. If not present, the <code>base</code> defaults to
360     <code>http://<var>servername</var>/</code>.</p>
361 </usage>
362 <seealso><directive module="core">UseCanonicalName</directive></seealso>
363 </directivesynopsis>
364
365 </modulesynopsis>