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的开源实 ...
随机推荐
- centos6.5安装sublime text 2
今天在看ueillemmx的博客的时候,看到一神级编辑器,随即安装试了试,我了个去,果然好用,自动补全,自动对齐,样样精通啊! 下面是根据ueillemmx的步骤在CentOS上安装Sublime的过 ...
- C/C++ http协议加载sessionID
很多时候,使用一个既定的API虽然可以去完成一些任务,但是还是不如自己写来的那么随性和自由. http协议,最常用的get,post两种方式传输数据,关于post,有时候,需要用到加载cookie信息 ...
- C#预编译指令之#region
#region和#endregion是一个区域注释(注释一段话.但是不是AU3内置的语法.内置的注释是 ";" 和 "#cs" 与 "#ce" ...
- echsop常用模板方法.
echsop模板遍历文件: {foreach from=$goods_list item=goods} {$goods.name} {/foreach} 不知道为什么ecshop中foreach像个注 ...
- iOS开发UI篇—推荐两个好用的Xcode插件(提供下载链接)
iOS开发UI篇—推荐两个好用的Xcode插件(提供下载链接) 这里推荐两款好用的Xcode插件,并提供下载链接. 一.插件和使用如下: 1.两款插件 对项目中图片提供自动提示功能的插件:KSImag ...
- 前端获取url参数
function GetQueryString(name){ var reg = new RegExp("(^|&)"+ name +"=([^&]*)( ...
- cookie 路径问题
Path – 路径.指定与cookie关联的WEB页.值可以是一个目录,或者是一个路径.如果http://www.zdnet.com/devhead /index.html 建立了一个cookie,那 ...
- struts2 log4j:WARN Please initialize the log4j system properly. 解决方法
在tomcat启动的时候,出现这个警告: log4j:WARN No appenders could be found for logger (org.apache.commons.digester. ...
- SCC(强连通分量)
1.定义: 在有向图G中,如果两个顶点间至少存在一条路径,称两个顶点强连通(SC---strongly connected). 有向图中的极大强连通子图,成为强连通分量(SCC---strongly ...
- 18、(番外)匿名方法+lambda表达式
概念了解: 1.什么是匿名委托(匿名方法的简单介绍.为什么要用匿名方法) 2.匿名方法的[拉姆达表达式]方法定义 3.匿名方法的调用(匿名方法的参数传递.使用过程中需要注意什么) 什么是匿名方法? 匿 ...