CakePHP链接css文件和javascript文件 [英] CakePHP linking css files and javascript files

查看:189
本文介绍了CakePHP链接css文件和javascript文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将css文件和javascript / jquery文件链接到控制器/视图?

How do you link css files and javascript/jquery files to a controller/view??

我使用CakePHP_1.3并找到了以下代码,但我不能找出在哪里放这个,其次,在哪里放置css文件名为css_file。

I am using CakePHP_1.3 and have located the following code online, but I cant seem to figure out where to put this, and secondly, where to place the css file named css_file.

<?php $this->Html->css("css_file", null, array("inline"=>false)); ?>

任何帮助赞赏的人...

Any help appreciated guys...

推荐答案

您将把CSS文件放在:

You would put the CSS file in:

app/
  webroot/
      css/ <-- here

default.ctp 布局。位于(1.3):

You would put the line of code in your default.ctp layout. This is located in (1.3):

cake/
  libs/
      view/
        layouts/
          default.ctp <-- copy this to app/views/layouts/

然后打开 app / views / layouts / default.ctp 并查看HTML。你会看到Cake已经在使用这个命令。只需用您添加的文件替换文件名。在添加代码行时, .css 添加到结尾。

Then open that up app/views/layouts/default.ctp and look at the HTML. You'll see where Cake is already using this command. Simply replace the filename with the file you added. Do not add the .css to the end when you add the line of code.

这篇关于CakePHP链接css文件和javascript文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆