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应用的网页的“类型”,一般服务于特定的功能并且有特定 ...
随机推荐
- SharePoint 2007 页面定制(一)
转:http://www.nanmu.net/SharePoint-MOSS-WSS-Silverlight/Lists/Posts/Post.aspx?ID=74 本文主要包括以下几方面内容: 1. ...
- NopCommerce架构分析之八------多语言
系统支持的语言是有类:Language表示: 多语言资源对应的类为:LocalizedProperty: 当先选择某种语言存储在类中:GenericAttribute: 多语言可以导出为XML文件,当 ...
- [Bhatia.Matrix Analysis.Solutions to Exercises and Problems]ExI.2.8
For any matrix $A$ the series $$\bex \exp A=I+A+\frac{A^2}{2!}+\cdots+\frac{A^n}{n!}+\cdots \eex$$ c ...
- mina2
远程通信 Mina2 学习笔记 作者:李少华 邮箱:xiaosanshaoli@126.com QQ:305409913 2010-12-23 初稿 引言... 1 一. Mina ...
- java.lang.UnsupportedOperationException
在运行路况预测这个项目时,报错出现:java.lang.UnsupportedOperationException 原因:我将1.3版本和1.6版本的两个jar包都Add to Build Path ...
- eclipse 项目报错问题
所有的问题在windoes-->show view--->Problems里查看
- 4.3 Reduction代码(Heterogeneous Parallel Programming class lab)
首先添加上Heterogeneous Parallel Programming class 中 lab: Reduction的代码: myReduction.c // MP Reduction // ...
- 关于C#动态调用VC Dll的方法(转)
http://blog.csdn.net/null1/article/details/3953155
- MATLAB将批量的图片保存为mat文件
clc; clear all; num = 10; for i = 1 : num IM = imread(sprintf('E:\\TEST\\PtzTEST2015-8-9\\image1280x ...
- 安森美电量计采用内部电阻跟踪电流--电压HG-CVR
http://www.dianyuan.com/article/34608.html LC709203F应用:用于便携式设备单节锂电池的智能电量计http://files.cnblogs.com/fi ...