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. 【转】android 最新 NDK r8 在window下开发环境搭建 安装配置与使用 详细图文讲解,完整实际配置过程记录(原创)

    原文网址:http://www.cnblogs.com/zdz8207/archive/2012/11/27/android-ndk-install.html android 最新 NDK r8 在w ...

  2. Collection Of SVM Libraries By Language via datasciencecentral

    http://www.datasciencecentral.com/profiles/blogs/collection-of-svm-libraries-by-language Support vec ...

  3. AM335x(TQ335x)学习笔记——挂载Ramdisk

    上篇文章中我们已经能够通过u-boot启动内核了,但是没有能够启动成功,从内核的log中可以看出,内核启动失败的原因是没有挂载到root文件系统,本文将使用busybox制作根文件系统并打包成ramd ...

  4. 理解Android的手势识别

    对于触摸屏,其原生的消息无非按下.抬起.移动这几种,我们只需要简单重载onTouch或者设置触摸侦听器setOnTouchListener即可进行处理.不过,为了提高我们的APP的用户体验,有时候我们 ...

  5. 刑事案件的构成要素 zt

    论刑事案件的构成要素   马忠红 2013-03-22 14:05:33 来源:<中国人民公安大学学报:社会科学版>(京)2012年5期 [内容提要]刑事案件是由诸多要素构成的一个系 统. ...

  6. MSP430的看门狗常见用法以及中断函数的书写方法

    今天下午看了一下MSP430的看门狗的基本用法 看门狗是为了防止程序跑飞而设定的,但是由于看门狗是一个类似于定时器,因此可以把他当作定时器来使用 示例代码:用看门狗定时器使一个led闪烁 #inclu ...

  7. MFC消息映射机制

    1.MFC应用框架主要类之间的关系 MFC自动生成的框架中重要的类有:C-App.CMainFrame.C-Doc和C-View. 其他的类如CClassView.CFileView等都是在框架窗口( ...

  8. uvalive 4589 Asteroids

    题意:给两个凸包,凸包能旋转,求凸包重心之间的最短距离. 思路:显然两个凸包贴在一起时,距离最短.所以,先求重心,再求重心到各个面的最短距离. 三维凸包+重心求法 重心求法:在凸包内,任意枚举一点,在 ...

  9. Linode各机房在中国访问速度性能测试

    最近因为google的各种被X的原因,想自己弄个VPS玩玩,比来比去都推荐linode. 因为各种性能测试工具都不靠谱,还是自己机器来的直接,虽然笨拙但是真实可信. 从测试结果上看,明显东京机房的速度 ...

  10. Java注解处理器使用详解

    在这篇文章中,我将阐述怎样写一个注解处理器(Annotation Processor).在这篇教程中,首先,我将向您解释什么是注解器,你可以利用这个强大的工具做什么以及不能做什么:然后,我将一步一步实 ...