twig一些常用的用法总结【原创】
{% if item.image is defined %}
<div class=”trade-show-imgs”>
{% for img in item.image %}
{% if img != “” %}
<div class=”trade-show-box”>
<img class=”small-img” src=”{{ asset(‘image/member/order/’) }}{{ img }}” alt=”” title=”” />
</div>
{% endif %}
{% endfor %}
</div>
{% endif %}
var dataid = data[i].id;
var dataimg = data[i].brand_image;
var idurl = “{{ path(‘zm_member_myCar_choose_series’,{‘id’:’dataId’})}}”;
idurl = idurl.replace(“dataId”,dataid);
var idimg = “{{ asset(‘image/brand/’) }}{{ ‘dataImg’ }}”;
idimg = idimg.replace(“dataImg”,dataimg);

{% for key,item in result %}
<div class=”lettlecity”>
<div class=”lettletitle”>{{ key }}</div>
{% for items in item %}
<a href=”{{ path(‘zm_frontend_set_city’,{‘id’:items.id}) }}” class=”lettlebox”>{{ items.name }}</a>
{% endfor %}
</div>
{% endfor %}
{% if reply is defined %}{% set floor = 2 %}
{% for item in reply %}
<p class=”message-floor”>{{ floor }}楼</p>
{% set floor = floor+1 %}
{% endfor %}
{% endif %}
七、twig循环-样式不同的(利用loop.index:从1开始)
<div class=”maintenance-men-content”>
{% for storelists in local_master %}
<div {% if loop.index == “1” %}style=”background: #c51a1a”
{% elseif loop.index == “2” %}style=”background: #1a53c5″
{% endif %}class=”maintenance-men-list”></div>
{% endfor %}
{{ app.session.get(‘member_name’) }}
{{ app.session.get(‘city_name’) }}
twig一些常用的用法总结【原创】的更多相关文章
- ansible常用模块用法
ansible常用模块用法 2015-07-21 10:25 24458人阅读 评论(1) 收藏 举报 分类: Linux(44) ansible 版权声明:本文为博主原创文章,未经博主允许不得 ...
- [转]jQuery的each方法的几种常用的用法
下面提一下jQuery的each方法的几种常用的用法 复制代码 代码如下: var arr = [ "one", "two", "three&quo ...
- python笔记之常用模块用法分析
python笔记之常用模块用法分析 内置模块(不用import就可以直接使用) 常用内置函数 help(obj) 在线帮助, obj可是任何类型 callable(obj) 查看一个obj是不是可以像 ...
- Anaconda中常用的用法
Anaconda中常用的用法 conda 是开源包(packages)和虚拟环境(environment)的管理系统. packages 管理: 可以使用 conda 来安装.更新 .卸载工具包 ,并 ...
- HTML常用标签用法及实例
HTML常用标签用法及实例1.<!--1.注释-->2.<!--2.DOCTPYE 声明文档类型-->3.<!--3.a--> <a href="h ...
- GNU g++常用编译选项用法
GNU g++常用编译选项用法 本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/30686/showart_1210761.html GCC ...
- C++中string常用函数用法总结
string(s小写)是C++标准库中的类,纯C中没有,使用时需要包含头文件#include<string>,注意不是<string.h>,下面记录一下string中比较常用的 ...
- Delphi常用关键字用法详解
本文详细介绍了Delphi中常用的各个关键字名称及用法,供大家在编程过程中借鉴参考之用.详情如下: absolute: ? 1 2 3 4 5 6 7 8 9 10 //它使得你能够创建一个新变量, ...
- hbase基本概念和hbase shell常用命令用法
1. 简介 HBase是一个分布式的.面向列的开源数据库,源于google的一篇论文<bigtable:一个结构化数据的分布式存储系统>.HBase是Google Bigtable的开源实 ...
随机推荐
- 两种JS方法实现斐波那契数列
第一种方法:递归 function fibonacci(n){ if (n==0){ return 0; }else if (n==1){ return 1; } return fibonacci(n ...
- logcat的条数设置
在软件默认设置下,logcat的缓存为1024,即logcat显示的条数有限,给程序的调试带来很大的不便,通过设置 logcat缓存的大小,可以增加logcat显示的条数,将程序调试的输出都可以打印出 ...
- Unix Shell 程序设计 —— 正则表达式
参考:http://www.cnblogs.com/erichhuang/archive/2012/03/13/2394119.html 简介: 简单的说,正则表达式是一种可以用于模式匹配和替换的强有 ...
- SQL Server基本函数
1. 字符串函数 1.1 datalength( char_expr ) ,返回表达式的字节数,不包含尾随空格 返回类型:如果 expression 的数据类型为 varchar(max).nvarc ...
- Introducing Windows 10 Editions(Windows10版本介绍)
Windows 10将在今年夏天正式发布,今天微软官方博客分享了一些Windows 10版本的细节.详见Introducing Windows 10 Editions Windows 10 HomeW ...
- jQuery遍历Json数组
var jsonArray= [{ "name": "张三", "password": "123456"},{ &qu ...
- 2014年5月份第2周51Aspx源码发布详情
Reapter手写分页控件源码 2014-5-12 [VS2010]源码描述:实现repeater控件分页,方便好用,界面设计也很漂亮.数据库是Access,可直接运行.入口是RepeaterTes ...
- (转)初探Backbone
(转)http://www.cnblogs.com/yexiaochai/archive/2013/07/27/3219402.html 初探Backbone 前言 Backbone简介 模型 模型和 ...
- ecshop安装常见问题及解决办法
一,Ecshop首页出现报错:Only variables should be passed by referen 最近想安装一个ECSHOP商城上去,老是报错,出现下面这就话: Strict Sta ...
- Python 基礎 - for流程判斷
今天介紹另一個循環判斷式 for循環,首先,先寫一個很簡單的 for循環的代碼 #!/usr/bin/env python3 # -*- coding:utf-8 -*- for i in range ...