phalcon: 资源文件管 理 引入css,js
<?php class IndexController extends Phalcon\Mvc\Controller
{
public function index()
{ //添加本地css资源
$this->assets
->addCss('css/style.css')
->addCss('css/index.css'); //添加本地js资源
$this->assets
->addJs('js/jquery.js')
->addJs('js/bootstrap.min.js'); }
}
phtml:
<html> <head> <title>
Some amazing website
</title> <?php $this->assets->outputCss() ?> </head> <body> <!-- ... --> <?php $this->assets->outputJs() ?> </body> <html>
方法二:远程文件
<?php public function indexAction()
{ //添加远程及本地资源
$this->assets
->addCss('//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css', true )
->addCss('css/style.css', false );
}
phtml:
同上
方法三:
<?php //html头部的js资源
$this->assets
->collection('header')
->addJs('js/jquery.js')
->addJs('js/bootstrap.min.js'); //html尾部的js资源
$this->assets
->collection('footer')
->addJs('js/jquery.js')
->addJs('js/bootstrap.min.js');
phtml:
<html> <head> <title>
Some amazing website
</title> <?php $this->assets->outputJs('header') ?> </head> <body> <!-- ... --> <?php $this->assets->outputJs('footer') ?> </body> <html>
phalcon: 资源文件管 理 引入css,js的更多相关文章
- WordPress引入css/js两种方法
WordPress引入css/js 是我们制作主题时首先面对的一个难点,任何一款主题都要加载自己的css,js,甚至很有可能还需要加载Jquery文件,网上方法特多,说法不一,我们今天借鉴wordpr ...
- 关于idea easyui 引入css js
1.引用官方网站 <link rel="stylesheet" type="text/css" href="http://www.w3cscho ...
- (4)WePHP 模板引入CSS js
模板有两个定义了两个常量 父类已经定义好了 //模板常量 $dirStr=dirname($_SERVER['SCRIPT_NAME']); $dirStr=$dirStr=='\\'?NULL:$d ...
- thinkphp5 前台模板的引入css,js,images
一:在公共的静态文件夹中建立我们模块的名称用来放置css,js,images 二:在配置文件config中定义需要的路径 三:在视图页面引入
- Spring Maven工程引入css,js
1.CSS <link th:href="@{/css/bootstrap.min.css}" rel="stylesheet" type="t ...
- 如何在vue && webpack 项目中的单文件组件中引入css
引入方式很简单,就是在script下使用require()即可. 因为import 是import...from 的形式,所以是不需要的. <script> import {mapStat ...
- ASP.NET MVC 扩展HtmlHelper类为 js ,css 资源文件添加版本号
写在前面 在项目部署当中会需要更新 css 文件或 js 等资源文件,为了避免由于浏览器缓存的原因无法加载新的 css 或 js ,一般的做法是在资源文件的后面加上一个版本号来解决,这样浏览器就会去服 ...
- 引入css外部样式表
前言 为什么会有这篇文章,外部引入样式有什么好谈的,不外乎就是 <link rel="stylesheet" href="style.css" /> ...
- Thymeleaf模版--子页面单独引入CSS、JS文件
https://blog.csdn.net/u010392801/article/details/80465800 ****************************************** ...
随机推荐
- Winform自定义分页控件的实现
实现效果 有点丑陋 但是功能是没问题的 测试过 实现思路 先创建一个用户控件 代码实现 public partial class PagerControl : UserControl { ; /// ...
- Failed to start component [StandardEngine[Catalina].StandardHost[localhost....
今天我用了近一天的时间研究一个错误,早上写代码是遇到一个 错误严重错误代码如下: 严重: ContainerBase.addChild: start: org.apache.catalina.Life ...
- javascript + jquery函数大全
JAVASCRIPT Array 函数 array创建数组 concat()连接两个或更多的数组,并返回结果. join()把数组中所有元素组成字符串. pop()删除并返回数组的最后一个元素 s ...
- Android各种获取Context方法
首先讲一讲这四个函数的区别,后面还有我对context的一些理解区别如下所示: 原文链接http://stackoverflow.com/questions/6854265/getapplicatio ...
- ArrayList,Vector,HashMap,HashSet,HashTable之间的区别与联系
在编写java程序中,我们最常用的除了八种基本数据类型,String对象外还有一个集合类,在我们的的程序中到处充斥着集合类的身影!java中集合大家族的成员实在是太丰富了,有常用的ArrayList. ...
- java使用Cipher进行签名和验签
public static void main(String[] args) { try { String plainText = "duwenlei"; KeyPairGener ...
- 微软的决心,开发者的信心!惊喜的 Connect(); // 2016
微软的决心,开发者的信心!惊喜的 Connect(); // 2016 Visual Studio for Mac 2014 年 11 月 13 日,微软宣布 .NET 开源与跨平台.两年后的今天 ...
- 网络编程(一)——InetAddress
网络编程(一)--InetAddress InetAddress类在java中代表的是IP地址,它有两个子类分别是Inet4Address和Inet6Address,其中Inet4Address代表的 ...
- 创建FrameWork
1, http://blog.sina.com.cn/s/blog_407fb5bc01013v6s.html] 2,使用动态库 http://www.cocoachina.com/industry/ ...
- 自动布局(Masonry)设置tabbar
//自定义标签工具栏 - (void) initTabBarView{ // self.bottomView = [[UIView alloc]initWithFrame:CGRectMake(, k ...