mod_imagemap
描述: | Server-side imagemap 处理 |
状态: | Base |
模块标识符: | imagemap_module |
源文件: | mod_imagemap.c |
摘要
该模块处理.map
files,从而替换imagemap
CGI 程序的功能。配置为使用处理程序imap-file
(使用AddHandler或SetHandler)的任何目录或文档类型都将由此模块处理。
以下指令将激活以.map
结尾的 files 为 imagemap files:
AddHandler imap-file map
请注意,仍然支持以下内容:
AddType application/x-httpd-imap map
但是,我们正在尝试淘汰“魔术 MIME 类型”,因此我们不赞成使用此方法。
新 Features
imagemap 模块添加了一些以前分发的 imagemap 程序无法实现的新功能。
- 相对于 Referer 的 URL references:信息。
- 通过新的 map 指令
base
进行默认<base>
赋值。 - 不需要
imagemap.conf
文件。 - 点参考。
- 可配置生成图像映射菜单。
Imagemap 文件
imagemap files 中的 lines 可以有以下几种格式之一:
directive value[x,y ...] directive value "Menu text"[x,y ...] directive value x,y ..."Menu text"
该指令是base
,default
,poly
,circle
,rect
或point
之一。 value 是绝对或相对 URL,或下面列出的特殊值之一。坐标是由空格分隔的x,y
对。如果生成图像映射菜单,则引用的文本将用作链接的文本。以'#'开头的是 comments。
Imagemap 文件指令
imagemap 文件中允许有六个指令。指令可以包含在任何 order 中,但是在 imagemap 文件中找到的 order 中处理。
base
指令
有<base href="value">的效果。 map-file 的 non-absolute URL 相对于此 value。 base 指令覆盖.htaccess 文件或 server configuration files 中设置的 ImapBase。如果没有 ImapBase configuration 指令,base 默认为 http://servername/。 base_uri 与 base 同义。请注意,URL 上的尾部斜杠很重要。default
指令
如果给定的坐标不符合 poly,circle 或 rect 指令中的任何一个,并且没有点指令,则采取的操作。如果没有 ImapDefault configuration 设置,则默认为 nocontent,导致返回状态 code 为 204 No Content。 client 应该保持显示相同的页面。poly
指令
需要三到 one-hundred 点,并且如果用户选择的坐标落在由这些点定义的多边形内,则遵循这些点。circle
采用圆的中心坐标和圆上的点。如果用户选择的点是圆圈,则遵守。rect
指令
采用矩形的两个相对角的坐标。如果选择的点在此矩形内,则为 Obeyed。point
指令
只需一点。如果不满足其他指令,则遵循最接近用户选择点的 point 指令。请注意,如果存在点指令并且给出了有效坐标,则不会遵循默认值。
值
每个指令的值可以是以下任何值:
- 一个 URL
URL 可以是相对 URL 或绝对 URL。相对 URL 可以包含“..”语法,并将相对于基本 value 进行解析。 base 本身不会根据当前的 value 解析。但是,mailto:语句将正常工作。 map
相当于 imagemap 文件本身的 URL。没有与此一起发送坐标,因此除非 ImapMenu 设置为 none,否则将生成一个菜单。menu
与 map 同义。referer
相当于引用文档的 URL。如果没有 Referer:标头,则默认为 http://servername/。nocontent
发送状态 code 为 204 No Content,告诉 client 保持显示相同的页面。适用于所有基础。error
失败,出现 500 服务器错误。除了默认以外的所有内容都有效,但对于除默认之外的任
坐标
0,0 200,200
坐标由以逗号分隔的 x 和 y value 组成。坐标通过空格彼此分开。为了适应 Lynx 处理图像映射的方式,如果用户选择坐标 0,0,就好像没有选择坐标一样。
引用文字
"Menu Text"
在 value 之后或坐标之后,line 可选地可以在 double 引号中包含文本。如果生成菜单,则此 string 用作链接的文本:<a href="http://example.com/">菜单文本</a>如果不存在引用文本,则链接的 name 将用作文本:<a href="http://example.com/"> http://example.com </a>如果要在其中使用 double 引号在这个文本中,你必须把它们写成&#52;。
Example Mapfile
#Comments are printed in a 'formatted' or 'semiformatted' menu.#And can contain html tags.<hr> base referer poly map "Could I have a menu, please?" 0,0 0,10 10,10 10,0 rect .. 0,0 77,27 "the directory of the referer" circle http://www.inetnebr.example.com/lincoln/feedback/ 195,0 305,27 rect another_file "in same directory as referer" 306,0 419,27 point http://www.zyzzyva.example.com/ 100,100 point http://www.tripod.example.com/ 200,200 rect mailto:nate@tripod.example.com 100,150 200,0 "Bugs?"
引用您的 mapfile
HTML example
<a href="/maps/imagemap1.map"><img ismap src="/images/imagemap1.gif"></a>
XHTML example
<a href="/maps/imagemap1.map"><img ismap="ismap" src="/images/imagemap1.gif"/></a>
ImapBase 指令
描述: | imagemap files 的默认值为base |
句法: | ImapBase map\|referer\|URL |
默认: | ImapBase http://servername/ |
Context: | server config,virtual host,directory,.htaccess |
覆盖: | 索引 |
状态: | Base |
模块: | mod_imagemap |
ImapBase
指令设置 imagemap files 中使用的默认base
。它的 value 被 imagemap 文件中的base
指令覆盖。如果不存在,则base
默认为http://servername/
。
参见
- UseCanonicalName
ImapDefault 指令
描述: | 使用未显式映射的坐标调用 imagemap 时的默认操作 |
句法: | ImapDefault error\|nocontent\|map\|referer\|URL |
默认: | ImapDefault nocontent |
Context: | server config,virtual host,directory,.htaccess |
覆盖: | 索引 |
状态: | Base |
模块: | mod_imagemap |
ImapDefault
指令设置 imagemap files 中使用的默认default
。它的 value 被 imagemap 文件中的default
指令覆盖。如果不存在,default
动作为nocontent
,这意味着204 No Content
被发送到 client。在这种情况下,client 应该继续显示原始页面。
ImapMenu 指令
描述: | 如果在调用 imagemap 时没有给出坐标,则执行操作 |
句法: | ImapMenu none\|formatted\|semiformatted\|unformatted |
默认: | ImapMenu formatted |
Context: | server config,virtual host,directory,.htaccess |
覆盖: | 索引 |
状态: | Base |
模块: | mod_imagemap |
ImapMenu
指令确定在没有有效坐标的情况下调用 imagemap 文件时所采取的操作。
none
如果 ImapMenu 为 none,则不会生成任何菜单,并执行默认操作。formatted
格式化的菜单是最简单的菜单。 _ imagemap 文件中的 Comments 被忽略。打印 level 一个标题,然后打印一个 hrule,然后将链接分别打印在单独的 line 上。菜单具有与目录列表一致的简洁外观。semiformatted
在 semiformatted 菜单中,comments 将打印在 imagemap 文件中。空行被转换为 HTML 中断。没有打印标题或小标题,但菜单与格式化菜单相同。unformatted
Comments 打印,空 lines 被忽略。没有打印出任何未出现在 imagemap 文件中的内容。所有中断和 headers 必须作为 comments 包含在 imagemap 文件中。这使您在菜单外观方面具有最大的灵活性,但要求您将 map files 视为 HTML 而不是纯文本。