开发者

Linking site-wide CSS file with CakePHP

开发者 https://www.devze.com 2023-03-21 06:45 出处:网络
I\'m very new to PHP, and just customizing my homepage. This is the main layout I have for all of my pages:

I'm very new to PHP, and just customizing my homepage. This is the main layout I have for all of my pages:

<!DOCTYPE html>
<html>
    <head>
        <title><?php echo $title_for_layout ?></title>
        <?php echo $scripts_for_layout ?>
    </head>
    <body>
        <div id="header">

        </div>
        <div id="content">
            <?php echo $content_for_layout ?>
        </div>
        <div id="footer">

        </div>
    </body>
</html>

I want to have a global CSS file for all pages on my site called "style.css" which will be stored in app/webroot/css/style.css. I have tried doing this:

<!DOCTYPE html>
<html>
    <head>
        <title><?php echo $title_for_layout ?></title>
        <link href="<?php $html->css('style', 'stylesheet', array('media'=>'all' ), false); ?>" rel="stylesheet" type="text/css" />
        <?php echo $scripts_for_layout ?>
    </head>
    <body>
        <开发者_开发百科div id="header">

        </div>
        <div id="content">
            <?php echo $content_for_layout ?>
        </div>
        <div id="footer">

        </div>
    </body>
</html>

But it's not showing up in the output HTML. Any ideas?

Thanks!


you are definitely new to Cake :) here:

<title><?php echo $title_for_layout ?></title>
  <?php 
    echo $this->Html->css('style');
    echo $scripts_for_layout;
  ?>

That will output the full link element for you.

0

精彩评论

暂无评论...
验证码 换一张
取 消