CakePHP 3.x - Load CSS in head tag for a specific action

后端 未结 1 1000
一个人的身影
一个人的身影 2020-12-22 00:10

So far I can only load a specific CSS file for a specific action by include that CSS file within tag from the corresponding view file. But I want t

相关标签:
1条回答
  • 2020-12-22 01:05

    In your template, this can be achieved by linking to the css file using the block option:

    Creates a link(s) to a CSS style-sheet. If the block option is set to true, the link tags are added to the css block which you can print inside the head tag of the document.

    I.e. anywhere in the relevant template:

    $this->Html->css('special', ['block' => true]);
    

    This is output by the fetch call in the layout:

    <?= $this->fetch('css') ?>
    
    0 讨论(0)
提交回复
热议问题