Apache SSI命令在我的HTML中添加空格

时间:2013-02-20 22:48:18

标签: apache cgi ssi

这是当前状态:

HTML FILE:
<!--#set var="header-title" value="Help - Frequently Asked Questions - FAQ" -->
<!--#set var="header-description" value="Answers to common questions about ..." -->
<!--#include virtual="includes/header-basic.htm" -->

INCLUDE FILE:
<!--#if expr="" -->
  Variables:
    header-title
    header-description
<!--#endif -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" />
<head>
...

RENDERED HTML:



<!DOCTYPE... (output starts here after several blank lines)

但是我想从渲染的HTML中挤出空白。这可能吗?另外,我使用hexdump确认我的文件中没有UTF8 BOM。

1 个答案:

答案 0 :(得分:1)

感谢(Ivan Shmakov)comp.infosystems.www.servers.unix。一种方法是:

<!--#set var="header-title" value="Help - Frequently Asked Questions - FAQ" 
--><!--#set var="header-description" value="Answers to common questions about ..." 
--><!--#include virtual="includes/header-basic.htm" --> 

另外,另一个选项(未记录的Apache行为?)是组合set指令:

<!--#set 
  var="header-title" value="Help - Frequently Asked Questions - FAQ"
  var="header-description" value="Answers to common questions about..."
--><!--#include virtual="includes/header-basic.htm" -->