Templates
2016-07-05 11:23
211 查看
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.
相关文章推荐
- 例题8-12 UVA - 12627 Erratic Expansion 奇怪的气球膨胀 (递归)
- kafka 的network
- 拨开kafka 的羊毛衫
- ProgressDialog使用
- shell 判断 404
- AES对称加密
- 101. Symmetric Tree
- Route Filters
- Routes
- Android中的布局和控件的隐藏和触发显示
- java 内存模型与线程 正文
- AndroidStudio如何打包生成realease版本的arr包,并上传到Nexus搭建的maven仓库,供项目远程依赖(二)
- [转载]DynaActionForm (动态ActionForm)
- Utuntu安装Bugzilla
- 主键约束,唯一约束与默认约束
- JAVA学习笔记two:关键字
- java 内存模型与线程 前传
- 大于、等于、小于等符号转换
- 使用tmodjs预编译模板实例
- C语言的常量