SSI包含在PHP作为模板不工作 [英] SSI included in PHP as template not working
问题描述
我使用的是用PHP编写神经节 - 网络前端。它使用模板文件添加个人页眉/页脚。我想使用SSI组页面,我写的,但SSI code不是由阿帕奇PTED间$ P $。
I am using Ganglia-web-frontend which is written in PHP. It uses template files to add personal headers/footers. I want to use an SSI set of pages that I have written, but the SSI code is not interpreted by apache.
更清楚,神经节使用 $ TPL =新TemplatePower(模板($ header.tpl));
,包括我的头模板文件。在我header.tpl文件中我把:<!code>&LT; - #包括虚拟=/包括/ header.shtml - &GT; 这是我的包含文件(和它与我的个人网页/脚本作品完美)。
more clearly, ganglia uses $tpl = new TemplatePower( template("$header.tpl") );
to include my header template file. In my header.tpl file I put : <!--#include virtual="/include/header.shtml" -->
which is my included file (and which works perfectly with my personal pages/scripts).
如果看向HTML code,我在Firefox中获得(CTRL + U)我看到了Apache包括SSI区&LT;! - #包括虚拟=/包括/ header.shtml - 方式&gt;
作为解说,并没有跨preded它
If look to the HTML code that I get in firefox (ctrl+U) I see that apache has included the SSI zone <!--#include virtual="/include/header.shtml" -->
as a commentary, and has not interpreded it.
我想有一些做事情与跨preded /执行的顺序,但我不能找到办法做工作。没有人有一个想法?我有Apache配置root访问过,如果需要的话。
I suppose there is something to do with the order in which things are interpreded/executed, but I cannot find the way to doing it work. Does anyone have an idea? I have root access to apache configuration too, if needed.
在此先感谢
编辑:
随着萨沙的建议,我已尝试添加
Following Sasha's suggestions I have tried to add
AddType text/html .tpl
AddHandler server-parsed .tpl
AddOutputFilter INCLUDES .tpl
到 /etc/apache2/httpd.conf 的,但这并不能帮助。我不明白这一点...
to /etc/apache2/httpd.conf but this does not help. I don't get it...
编辑2:
我想这也许是到PHP的问题 TemplatePower 模块。但我不能得到它的工作。我曾尝试还加入 $ tpl-&GT; assignInclude(头,./header.tpl);
在神经节的来源,但这并不能帮助。
I guess it is maybe a problem with PHP TemplatePower module. But I cannot get it work. I have tried adding also $tpl->assignInclude( "header", "./header.tpl" );
in ganglia sources but this does not help.
推荐答案
就是Apache配置为preprocess .tpl
文件作为服务器端包含?如果不是,它会忽略这些文件SSI指令。
Is Apache configured to preprocess .tpl
files as Server-Side Includes? If not, it will ignore SSI directives in those files.
在一节启用服务器端包含的mod_include负责文档中对如何配置此细节。你需要确保 .tpl
是present的将AddType
和 AddOutputFilter
指令。
The section on 'Enabling Server-Side Includes' in the mod_include documentation has details on how to configure this. You'll need to ensure that .tpl
is present in the AddType
and AddOutputFilter
directives.
这篇关于SSI包含在PHP作为模板不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!