随笔分类 - Symfony2
摘要:Symfony安装地址:http://symfony.dubture.com/installation/PHP调试器:http://www.xdebug.org/wizard.phpSymfony2相关文章汇总:http://firehare.blog.51cto.com/809276/703599Eclipse的Helios版本安装:http://wiki.eclipse.org/PDT/Installation#Eclipse_3.6_.2F_Helios_.2F_PDT_2.2doctrine的API:http://docs.doctrine-project.org/projects/d
阅读全文
摘要:$params["testform"]=$employeeForm->createView();$params["testform"]->getChild('role')->getChild(1)->set('read_only',true);其他可参考Symfony\Component\Form\FormView
阅读全文
摘要:写了好几篇关于twig的东西。。居然还没写个快速入门之类的。现在就写来源 http://twig.sensiolabs.org/doc/templates.html概要twig 的模板就是普通的文本文件,也不需要特别的扩展名,.html .htm .twig 都可以。模板内的 变量 和 表达式 会在运行的时候被解析替换,标签(tags)会来控制模板的逻辑下面是个最小型的模板,用来说明一些基础的东西[html] view plaincopyprint?<!DOCTYPE html> <html> <head> <title>My Webpage&l
阅读全文
摘要:文章来源:http://twig.sensiolabs.org/doc/tests/index.html做逻辑判断的。目前支持的有divisibleby null even odd sameas constant defined emptydivisibleby检查是否能被整除[html] view plaincopyprint?{% if loop.index is divisibleby(3) %} ... {% endif %} {% if loop.index is divisibleby(3) %} ...{% endif %}null[html] view plaincop...
阅读全文
摘要:目前twig内建的函数包括attribute, block, constant, cycle, dump, parent, random, range.其实部分函数,在tags的学习里已经见过了。attribute函数1.2版本新增他就相当于是个. 操作符。[html] view plaincopyprint?{{ attribute(object, method) }} {{ attribute(object, method, arguments) }} {{ attribute(array, item) }} {{ attribute(object, method) }}{{ attrib
阅读全文
摘要:set标签主要是用来给变量赋值的。[html] view plaincopyprint?{% set foo = 'foo' %} {% set foo = [1, 2] %} {% set foo = {'foo': 'bar'} %} {% set foo = 'foo' ~ 'bar' %} {% set foo, bar = 'foo', 'bar' %} {% set foo = 'foo' %}{% set foo = [1, 2] %}{% set fo
阅读全文
摘要:文章来源 http://twig.sensiolabs.org/doc/tags/index.htmluse标签use标签是1.1版本新添加内容。这个use标签主要是来解决模板只能从一个父模板继承,而你又想重用其他模板的问题。但是use标签只会导入block区块,(注意import只会导入宏macros,include会导入一切。这三个标签要区分清楚)比如[html] view plaincopyprint?{% extends "base.html" %} {% use "blocks.html" %} {% block title %}{% endb
阅读全文
摘要:Twig 是个 简单而强力的模板,因为在学习sf 所以看看她。本文来源http://twig.sensiolabs.org/doc/tags/index.html目前支持的tags包括 for if macro filter set extends block include import from use spaceless autoescape raw flush dotwig在html分为3种{{...}} 直接输出其中的变量{#...#} 注释标签{%...%} 命令标签,就是我们要学习的这些for标签这个最简单,就是循环。基于数组的循环[html] view plaincopypri
阅读全文
摘要:目前支持的过滤器包括date format replace number_format url_encode json_encode convert_encoding title capitalize nl2br upper lower striptags join reverse length sort default keys escape raw mergedate过滤器1.1版本新增时区支持,1.5版本增加了默认的日期格式。这个过滤器和php的date函数无限类似[html] view plaincopyprint?{{ post.published_at|date("m/d
阅读全文
摘要:CSS文件的更新php app/console assets:install web/Entity的生成 根据数据库定义,生产Entity的命令根据数据库表生成yml文件(或其他xml..)php app/console doctrine:mapping:convert yml ./src/HRSystem/CommonBundle/Resources/config/doctrine/metadata/orm --from-database --force根据数据库(yml)生成对应影射类php app/console doctrine:mapping:import HRSystemComm.
阅读全文
摘要:在symfony2.0中,如果不安装DataGridBundle会出现这种错误:you have requested a non-existent service "grid"解决方法如下在../app/AppKernel.php 中添加 new Sorien\DataGridBundle\SorienDataGridBundle(),在../app/autoload.php中$loader->registerNamespaces(array( 'Symfony' => array(__DIR__.'/../vendor/symfony/
阅读全文
摘要:$("#goback").click(function(){location.href="{{ path('_h710_index') }}"; });
阅读全文
摘要:1、格式化字符 34,234.0 {{ (itemVolume.priceCoin/itemVolume.count)|number_format(1, '.', ',') }}2、逻辑判断循环 {% set count=0 %} {% for keyvalue,itemVolume in itemVolumes %} {% set count=count+1 %} {% endfor %}条件 {% if count % 2==0 %}<tr class="line01" id="R{{ itemVolume.itemId
阅读全文
浙公网安备 33010602011771号