繁体   English   中英

当我使用 cakephp 时,我在哪里放置 PIE.htc 文件(用于使 IE 与 CSS3 一起工作)

[英]where do I put the PIE.htc file (for making IE work with CSS3) when I'm using cakephp

我正在尝试使用PIE.htc ,这是一个脚本,希望可以让我在 IE6-8 中使用 CSS3 功能。 我也在使用 Cakephp (我越来越喜欢它了)

根据说明,我只需将 PIE.htc 文件粘贴到我想要的任何位置,然后添加behavior: url(path/to/PIE.htc); 到 CSS。 所以我有:

input[type=text]{
    width:348px;
    height:30px;
    border:1px solid #ddd;
    padding:3px;
    background:url(../img/formfieldbg.gif) repeat-x;
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
    border-radius: 5px;
    vertical-align:top;
    behavior: url(path/to/PIE.htc);}

它还说:注意:此路径是相对于正在查看的 HTML 文件,而不是从中调用它的 CSS 文件。

我正在使用 Cakephp 并且无论我为路径放置什么,无论我将 PIE.htc 文件放在哪里,我都无法使其工作。 当我在 IE6 中查看它时,我的输入仍然没有像在 FF 中那样可爱的圆角。

尝试使用绝对路径:

behavior: url(/path/to/PIE.htc);

注意前导正斜杠。 这样,无论当前页面是什么, .htc文件的路径都将保持不变。

完整的 URL 也可以工作:

behavior: url(//example.com/path/to/PIE.htc);

如果您确实使用完整的 url,请使用与 url相关的协议,以便在切换到 https 时不会收到不安全的内容警告。

很多元素在使用 PIE 时需要position:relativezoom:1才能在 IE 中运行,请确保检查已知问题页面并玩弄直到你让它工作。

您需要指定 pie.php 文件。 其内容如下:

<?php
/*
This file is a wrapper, for use in PHP environments, which serves PIE.htc using the
correct content-type, so that IE will recognize it as a behavior.  Simply specify the
behavior property to fetch this .php file instead of the .htc directly:

.myElement {
    [ ...css3 properties... ]
    behavior: url(PIE.php);
}

This is only necessary when the web server is not configured to serve .htc files with
the text/x-component content-type, and cannot easily be configured to do so (as is the
case with some shared hosting providers).
*/

header( 'Content-type: text/x-component' );
include( 'PIE.htc' );
?>

那应该可以解决问题。

我正在使用 CodeIgniter 和mod_rewrite 根据 Septagram 的回答,我得到了以下工作

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]

#if the url contains PIE.php redirect to the folder containing PIE.php
RewriteCond %{REQUEST_URI} PIE.php$
RewriteRule ^.*$ css3pie/PIE.php [NC,L]

#else just redirect to index
RewriteRule ^.*$ index.php [NC,L]

希望这可以帮助某人

如果您碰巧在使用mod_rewrite ,那么以下小技巧可能适合您:

RewriteRule /PIE.htc$ PIE.htc [L]

将此添加到.htaccess和瞧! 现在PIE.htc神奇地出现在每个文件夹中:)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM