Templates
Templates
Templates are the site's markup, where images and js, css files are located as well as the site html structure. The default template is called Default.
A regular site would have multiple css files and a javascript folder containing js files, an image folder. The rest of the sites pages come from the views.
The typical elements of a page include the following. The title comes from an array with a key of the title followed by the constant SITETITLE, this lets the controllers set the page titles in an array that is passed to the template.
The template_url function is being used to get the full path to the CSS file.
Routing Images / CSS / JS files
When files are above the document root resources must be placed inside the Templates/Default/Assetsfolder otherwise they won't be loaded correctly.
To load images the template_url function can be used, it accepts 2 params
- The relative path of the asset
- the theme to be used.
<img src='<?php echo template_url('images/logo.jpg', 'Default');?>' alt=''>
Page example:
<!DOCTYPE html>
<html lang="<?php echo LANGUAGE_CODE; ?>">
<head>
<meta charset="utf-8">
<title><?php echo $title.' - '.SITETITLE;?></title>
<?php
echo $meta;//place to pass data / plugable hook zone
Assets::css([
'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css',
template_url('css/style.css', 'Default')',
]);
echo $css; //place to pass data / plugable hook zone
?>
</head>
<body>
<?php echo $afterBody; //place to pass data / plugable hook zone?>
<div class="container">
The default template comes with multiple files to demonstrate different use cases.
default.php and custom.php are full page layouts whilst header.php and footer.php are partial layouts that can be mixed, the files ending with -rtl.php mean they are right to left formats.
A theme can be as simple as a single layout file and an assets folder and message.php file.
Templates的更多相关文章
- 解决Windows版Git出现templates not found的问题
环境: Win10 x64 Git windows客户端(下载自 https://git-scm.com/) SourceTree 1.9.6.1(使用系统安装的Git,而非SourceTree内嵌的 ...
- [c++] Templates
Template是编译时多态.所有的模板都是在编译时产生对应的代码,它没有面向对象中的虚表,无法实现动态多态. Function Template A function template is a p ...
- webstrom live templates
javascript: 在live templates底部要选择javascript # $('#$END$') $ $($end$) $bd $(document.body) $d $(docume ...
- Myeclipse Templates详解(一) —— Java模板基础
目录 Templates简介 MyEclipse自带Templates详解 新建Template 自定义Template 因为自己比较懒,尤其是对敲重复代码比较厌恶,所以经常喜欢用快捷键和模板,Mye ...
- Using FreeMarker templates (FTL)- Tutorial
Lars Vogel, (c) 2012, 2016 vogella GmbHVersion 1.4,06.10.2016 Table of Contents 1. Introduction to F ...
- juqery模板 Templates
现在已经有了许多JavaScript的解决方案模板,从这方面说,标准化的模板解决方案必然是大势所趋.在本节中,我们向你简要描述四个最流行最有趣的模板.现有的模板解决方案能解决什么?那些特色在jQuer ...
- django TEMPLATES
?: (1_8.W001) The standalone TEMPLATE_* settings were deprecated in Django 1.8 and the TEMPLATES dic ...
- django复习笔记3:urls/views/templates三板斧
0.先看看文件结构 mysite/ mysite/ ├── __pycache__ │ └── manage.cpython-.pyc ├── blog │ ├── __init__.py │ ...
- Effective C++ -----条款44:将与参数无关的代码抽离templates
Templates生成多个classes和多个函数,所以任何template代码都不该与某个造成膨胀的template参数产生相依关系. 因非类型模板参数(non-type template para ...
- 第三节:视图(Views)和模板(Templates)
目录 概览 编写视图 编辑视图实际做一些事情 抛出404异常 使用模板系统 移除在代码中的硬编码网址 Url名称的命名空间 概览 视图是Django应用的网页的“类型”,一般服务于特定的功能并且有特定 ...
随机推荐
- MySQL性能指标及计算方法
绝大多数MySQL性能指标可以通过以下两种方式获取: (1)mysqladmin 使用mysqladmin extended-status命令获得的MySQL的性能指标,默认为累计值.如果想了解当前状 ...
- Java中调用参数是数组的存储过程
Java中调用参数是数组的存储过程 1. 存储过程以及类型定义如下: --The array in oracle CREATE OR REPLACE TYPE idArray AS TABLE OF ...
- 34、Android中基于Socket的网络通信(一)
Socket又称”套接字”,应用程序通常通过”套接字”向网络发出请求或者应答网络请求. 在java中,Socket和ServerSocket类库位于java.net包中,ServerSocket用于服 ...
- RAM, SDRAM ,ROM, NAND FLASH, NOR FLASH
在看上面2440的内存映射的时候,对其中的有些名字,不是完全太懂,所以到网上找了相关的信息. 对于mini2440来说,SDRAM,即内存,程序运行时的地方.选择连接SDRAM的为bank6. 1)S ...
- javascript设计模式5
子类引用父类 function extend(subClass,superClass){ var F=function(){}; F.prototype=superClass.prototype; s ...
- 关于java线程池 Ⅱ
上一篇翻译了线程池主要部分的api,经过一段时间的学习,这里记录一下这段时间对jdk自带线程池的学习成果. 为了方便说明,先放一张类图,包括了jdk线程池主要涉及到的类,为了条理清晰去掉了部分依赖和关 ...
- 【原创】linux命令bc使用详解
最近经常要在linux下做一些进制转换,看到了可以使用bc命令,如下: echo "obase=10;ibase=16;CFFF" | bc 用完以后就对bc进行了进一步的了解, ...
- HW7.2
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
- JavaScript获取HTML页面源代码
来自:http://www.cnblogs.com/luckbird/archive/2008/02/01/1061048.html <a href="javascript:gets( ...
- hdoj 1874 畅通工程续【dijkstra算法or spfa算法】
畅通工程续 Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submi ...