cakephp中的目录分隔符会禁用我的CSS

时间:2012-05-30 03:12:29

标签: css cakephp

是我每次使用时得到的,

$certpath = APP."Plugin".DS."PaypalIpn".DS."Controller".DS."Certificates".DS;

在我的代码中,它破坏了我的CSS。好吧,不一定是废墟,但我的页面好像没有使用任何css进行对齐或其他东西。

我需要DS,因为我必须调用该目录中的文件

$encryption['cert_file'] = $certpath.$encryption['cert_file'];

我试过了:

$encryption['key_file'] = $certpath.DS.$encryption['key_file'];
$encryption['cert_file'] = $certpath.DS.$encryption['cert_file'];
$encryption['paypal_cert_file'] = $certpath.DS.$encryption['paypal_cert_file'];

仍然没有运气。前两行是这样工作的,但第三行没有。

我尝试用这些关键字搜索:

directory separator in cakephp ruins my css
uses of directory separator in cakephp
calling files using directory separator in cakephp

但没有一个帮助我。

DS只是一个目录分隔符吗?什么可能是错的?

..........编辑部分

这是另一个问题,我从上一期发现了罪魁祸首,但请解释一下它与我的问题有什么关系。这是我的PaypalHelper.php

<?php

$importConfig = array(
                'type' => 'File',
                'name' => 'PaypalIpn.ppcrypto',
                //'file' => CONFIGS .'paypal_ipn_config.php'
                'file' => APP."Plugin".DS."paypal_ipn".DS."libs".DS."ppcrypto.php"
            );
//... other codes
//..other functions

function button($title, $options = array(), $buttonOptions = array()) {
//..other codes

$certpath = APP."Plugin".DS."PaypalIpn".DS."Controller".DS."Certificates".DS;

//..other codes

}
?>

看到这段代码?

$importConfig = array(
                'type' => 'File',
                'name' => 'PaypalIpn.ppcrypto',
                //'file' => CONFIGS .'paypal_ipn_config.php'
                'file' => APP."Plugin".DS."paypal_ipn".DS."libs".DS."ppcrypto.php"
            );

这个?

$certpath = APP."Plugin".DS."PaypalIpn".DS."Controller".DS."Certificates".DS;
$encryption['paypal_cert_file'] = $certpath.$encryption['paypal_cert_file'];

$ importConfig ..它错了,因为它应该是

$importConfig = array(
                'type' => 'File',
                'name' => 'PaypalIpn.ppcrypto',
                //'file' => CONFIGS .'paypal_ipn_config.php'
                'file' => APP."Plugin".DS."PaypalIpn".DS."libs".DS."ppcrypto.php"
            );

..但是当我试图纠正它时,$ encryption ['paypal_cert_file']运行正常。它不会破坏/(禁用?)我的css

我先把它作为一个答案,但我相信仍然存在一些问题......

1 个答案:

答案 0 :(得分:1)

我几乎可以肯定无论是什么或错误都是致命错误或某种其他错误输出弄乱了你的HTML输出。

有时即使启用了调试,屏幕上也看不到错误,您必须检查HTML源代码,特别是如果错误发生在HTML的<head>部分,Javascript内部或关闭之前{{ 1}}标签。我建议你在修正错误时解决了问题。

我会仔细检查你是否启用了调试。请参阅蛋糕文档中的CakePHP Core Configuration

如果你已经修复了问题,但仍想知道是什么原因造成的,请尽可能撤消更改并检查我上面提到的内容。除此之外,我没有在您的代码中看到任何可能导致问题的明显事实。