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

  1. The relative path of the asset
  2. 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的更多相关文章

  1. 解决Windows版Git出现templates not found的问题

    环境: Win10 x64 Git windows客户端(下载自 https://git-scm.com/) SourceTree 1.9.6.1(使用系统安装的Git,而非SourceTree内嵌的 ...

  2. [c++] Templates

    Template是编译时多态.所有的模板都是在编译时产生对应的代码,它没有面向对象中的虚表,无法实现动态多态. Function Template A function template is a p ...

  3. webstrom live templates

    javascript: 在live templates底部要选择javascript # $('#$END$') $ $($end$) $bd $(document.body) $d $(docume ...

  4. Myeclipse Templates详解(一) —— Java模板基础

    目录 Templates简介 MyEclipse自带Templates详解 新建Template 自定义Template 因为自己比较懒,尤其是对敲重复代码比较厌恶,所以经常喜欢用快捷键和模板,Mye ...

  5. Using FreeMarker templates (FTL)- Tutorial

    Lars Vogel, (c) 2012, 2016 vogella GmbHVersion 1.4,06.10.2016 Table of Contents 1. Introduction to F ...

  6. juqery模板 Templates

    现在已经有了许多JavaScript的解决方案模板,从这方面说,标准化的模板解决方案必然是大势所趋.在本节中,我们向你简要描述四个最流行最有趣的模板.现有的模板解决方案能解决什么?那些特色在jQuer ...

  7. django TEMPLATES

    ?: (1_8.W001) The standalone TEMPLATE_* settings were deprecated in Django 1.8 and the TEMPLATES dic ...

  8. django复习笔记3:urls/views/templates三板斧

    0.先看看文件结构 mysite/ mysite/ ├── __pycache__ │   └── manage.cpython-.pyc ├── blog │   ├── __init__.py │ ...

  9. Effective C++ -----条款44:将与参数无关的代码抽离templates

    Templates生成多个classes和多个函数,所以任何template代码都不该与某个造成膨胀的template参数产生相依关系. 因非类型模板参数(non-type template para ...

  10. 第三节:视图(Views)和模板(Templates)

    目录 概览 编写视图 编辑视图实际做一些事情 抛出404异常 使用模板系统 移除在代码中的硬编码网址 Url名称的命名空间 概览 视图是Django应用的网页的“类型”,一般服务于特定的功能并且有特定 ...

随机推荐

  1. Wiz开发 定时器的使用与处理

    这只是一些代码片段,由于Wiz开发的资料实在不多,而且内容都不够新. 这里的代码主要参考Tools.Timer这个插件,但是由于内部实现的很多变化,Tools.Timer这个插件基本上已经无法使用了. ...

  2. iOS--跳转到APPstore评分

    本代码适用于iOS7之后的版本: NSString *str = [NSString stringWithFormat:@"itms-apps://itunes.apple.com/app/ ...

  3. json解析之jackson ObjectMapper

    Json解析常用的有fastjson和jackson,性能上网上有不少的对比,说是fastjson比较好,今天先整理一下jackson的东西,后面再发一个fastjson的. jackson是spri ...

  4. 房租管理小软件(四):对linq的使用

    1.对LInq的封装如下: private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMap ...

  5. HDFS的shell操作

    bin/hadoop命令操作: namenode -format 格式化文件系统 fs(缩写:FileSystem) 运行一个文件系统的用户客户端 bin/hadoop fs常用命令操作: -ls h ...

  6. ffmpeg ffprobe ffplay

    ./ffprobe -print_format json -show_format -show_frames -select_streams v -i ../hhh.flv ./ffprobe -pr ...

  7. yum 安装 PHP,apache,nginx,mysql

    如果是Centos OS 64 位,首先更新 rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarc ...

  8. SAP:建表时如果有QUAN、CURR类型的字段不能激活的问题

    建表时如有一个QUAN类型的字段,那么就要给字段设置Reference field,参考的字段的Data Type要是UNIT, 并设置对应的Reference table,也就是参考字段所在的tab ...

  9. Java之泛型练习

    package cn.itcast.generics; import java.util.Comparator; import java.util.Iterator; import java.util ...

  10. [OC Foundation框架 - 21] NSSet集合 & 集合之间的转换

    A.NSSet 跟NSArray一样,不可变 NSArray 自然顺序 NSSet是无序的 NSSet不允许存入重复元素,可以用来过滤重复元素   也有可变的NSMutableSet   B.集合转换 ...