Cakephp 2.3 $this->;Html->;带有inline=false的css不';行不通

Cakephp 2.3 $this->;Html->;带有inline=false的css不';行不通,cakephp-2.3,Cakephp 2.3,我正在使用inline=false在视图中定义css块。在布局中,我尝试获取此块。但这不起作用。我认为问题是通过以下代码来解释的。以下是我的看法: <script type="text/javascript"> $(function() {$(".datepicker").datepicker({ numberOfMonths: 3, showButtonPanel: false} );}); </script> <?php $this->H

我正在使用inline=false在视图中定义css块。在布局中,我尝试获取此块。但这不起作用。我认为问题是通过以下代码来解释的。以下是我的看法:

<script type="text/javascript">
$(function() {$(".datepicker").datepicker({
   numberOfMonths: 3,
   showButtonPanel: false}
   );});
</script>
<?php $this->Html->script(array('jquery-1.10.1.min', 'jquery-ui', 'jquery-ui-datepicker-de'), array('inline' => false));
      $this->Html->css('jquery-ui.css', array('inline' => false)); ?>

<div class="schooltimes form">
<?php echo $this->Form->create('Schooltime'); ?>
    <fieldset>
        <legend><?php echo 'Schulunterrichtstermin hinzufügen'; ?></legend>
        <?php
             echo $this->Form->input('dateinput', array('class'=>'datepicker', 'type'=>'text', 'label' => 'Datum des nächsten Schulunterrichtstermins'));
             echo $this->Form->input('timeinput', array('type' => 'text', 'label' => 'Uhrzeit des Unterrichtsendes im Format HH:MM'));
             echo $this->Form->input('school', array('type'=>'text', 'label'=>'Schule / Universität / Fachhochschule / sonstige Bildungseinrichtung'));
             echo $this->Form->input('grade', array('type'=>'text', 'label'=>'Klasse / Stufe / Semester'));
             echo $this->Form->input('teacher', array('type'=>'text', 'label'=>'Lehrer / Dozent'));
             echo $this->Form->input('subject', array('type'=>'text', 'label'=>'Fach / Kurs'));
             echo $this->Form->input('book', array('type'=>'text', 'label'=>'Schulbuch / Skript / Basislektüre'));
             echo $this->Form->input('inter', array('type' => 'select', 'label' => 'Rhythmus', 'options' => array('P1W' => 'wöchentlich', 'P2W' => '2-wöchentlich')));
        ?>
    </fieldset>
<?php echo $this->Form->end(array('label' => 'Speichern')); ?>
</div>

$(函数(){$(“.datepicker”).datepicker({
月数:3,
showButtonPanel:false}
);});
这是布局图:

<!DOCTYPE html>
<html>
<head>
    <?php echo $this->Html->charset(); ?>
    <title>
        <?php echo 'Kundenservice' ?>:
        <?php echo $title_for_layout; ?>
    </title>

    <?php
       echo $this->Html->meta('icon');
       echo $this->fetch('meta');
       echo $this->fetch('css');  // doesn't work
       echo $this->fetch('script');  // works fine
    ?>
</head>
<body>...

:
试试这个:

<?php $this->Html->script(array('jquery-1.10.1.min', 'jquery-ui', 'jquery-ui-datepicker-de'), array('block' => 'script'));
      $this->Html->css('jquery-ui.css', array('block' => 'css')); ?>

我用的是2.3.0。如果您查看HtmlHelper css函数,它看起来像:

public function css($path, $rel = null, $options = array())
因此,cakephp网站上的文档中没有提到$rel参数()

只需将您的呼叫更改为:

$this->Html->css('jquery-ui.css',null, array('inline' => false)); 

一切都会好起来的

谢谢你的回答。我试过了,但没用。我注释掉了另外两个:echo$this->Html->meta('icon');并在我的布局中回显$this->fetch('meta');但这没用。脚本部分从一开始就可以完美地工作。当我将视图中的css命令更改为:echo$this->Html->css('jquery-ui.css');同样,它可以工作,但是样式表被加载到HTML的主体中,而不是头部。我根本无法将css放入块中。我的cake php版本是2.3.1wow,事实上这就是解决方案。谢谢!您是否向cake php团队提供了修改文档的说明?
public function css($path, $rel = null, $options = array())
$this->Html->css('jquery-ui.css',null, array('inline' => false));