2013-03-13 21 views
1

伊夫試圖添加的ESI與{「獨立」:真正}渲染到我的樹枝一個模板,然後我得到的樹枝語法錯誤:枝條語法錯誤在symfony中實現ESI時2.1.8

Unexpected token "punctuation" of value "," ("end of statement block" expected) in AccommMiddleBundle:Home:layout.html.twig at line 155

這裏是有關枝杈模板塊:

150 <div class="container"> 
151  <h1>{{ blog_articles.0.title }}</h1> 
152  <a href="{{blog_articles.0.guid}}">Moose</a> 
153 </div> 
154 
155 {% render url('accomm_middle_home_recent_articles', {fred: 1}), {'standalone': true} %} 
156 
157 {% set charity_url = "http://www.accommodation.com/charity" %} 

取出,{「獨立」:真正}被渲染精細的模板。

我使用Symfony 2.1.8與一個乾淨的供應商,似乎沒有區別與標準版的依賴關係。有關如何調試的任何想法?

感謝您的幫助

MikeB

附:這裏是我安裝的軟件包

AccomDotCom/AccomDotComRESTClientBundle 0.1    The RESTFul models for talking to the Accommodation.com privateapi (baghdadsquirrel) via symfony 
behat/behat        v2.4.5   Scenario-oriented BDD framework for PHP 5.3 
behat/gherkin       v2.2.9   Gherkin DSL parser for PHP 5.3 
behat/mink        v1.4.3   Web acceptance testing framework for PHP 5.3 
behat/mink-browserkit-driver   v1.0.4   Symfony2 BrowserKit driver for Mink framework 
behat/mink-extension     v1.0.1   Mink extension for Behat 
behat/mink-selenium2-driver    v1.0.5   Selenium2 (WebDriver) driver for Mink framework 
behat/mink-zombie-driver    v1.0.3   Zombie.js driver for Mink framework 
behat/symfony2-extension    v1.0.1   Symfony2 framework extension for Behat 
doctrine/common       2.3.0    Common Library for Doctrine projects 
doctrine/dbal       2.3.2    Database Abstraction Layer 
doctrine/doctrine-bundle    v1.0.0   Symfony DoctrineBundle 
doctrine/orm       2.3.2    Object-Relational-Mapper for PHP 
guzzle/guzzle       v2.8.7   Guzzle is a PHP HTTP client library and framework for building RESTful web service clients 
instaclick/php-webdriver    1.0.12   PHP WebDriver for Selenium 2 
jms/aop-bundle       1.0.0    Adds AOP capabilities to Symfony2 
jms/cg         1.0.0    Toolset for generating PHP code 
jms/di-extra-bundle      1.1.1    Allows to configure dependency injection using annotations 
jms/metadata       1.1.1    Class/method/property metadata management in PHP 
jms/security-extra-bundle    1.2.0    Enhances the Symfony2 Security Component by adding several new features 
kriswallsmith/assetic     v1.1.0-alpha4  Asset Management for PHP 
monolog/monolog       1.2.1    Logging for PHP 5.3 
nelmio/esi-debug-bundle     1.0.0    Shows you caching information around ESI requests for debugging purposes 
sensio/distribution-bundle    v2.1.8   The base bundle for the Symfony Distributions 
sensio/framework-extra-bundle   v2.1.8   This bundle provides a way to configure your controllers with annotations 
sensio/generator-bundle     v2.1.8   This bundle generates code for you 
swiftmailer/swiftmailer     v4.2.2   Swiftmailer, free feature-rich PHP mailer 
symfony/assetic-bundle     v2.1.2   Integrates Assetic into Symfony2 
symfony/monolog-bundle     v2.1.8   Symfony MonologBundle 
symfony/swiftmailer-bundle    v2.1.8   Symfony SwiftmailerBundle 
symfony/symfony       v2.1.8   The Symfony PHP framework 
twig/extensions       dev-master v1.0.0 Common additional features for Twig that do not directly belong in core 
twig/twig        v1.12.2   Twig, the flexible, fast, and secure template language for PHP 
vipsoft/jira-extension     v1.0.9   Load features for Behat from Jira issues 

回答

0

Symfony2.1,以適應您的渲染塊到正確的符號,你需要

  • 把單引號'之間的爭論:在這種情況下,你本來'fred': 1
  • 添加with{}聲明即使它是空

它給你:

{% render url('accomm_middle_home_recent_articles', {'fred': 1}) with {}, {'standalone': true} %} 

注:看起來是絕對需要在Symfony2.1的with{}聲明,從這個security release。然而,Symfony最近可能已經改變了這一點,我認爲它不再需要在Symfony2.2中。

{#的與參數需要的,但忽略#}

和示例它們提供與它:

{% render url("path_to_controller_router", { 'param': 1 }) with {}, { 'standalone': true } %} 
+0

感謝@Patt使用來自[symfony的HTTP緩存]的DOCO (http://symfony.com/doc/2.1/book/http_cache.html#edge-side-includes),並沒有看到安全通報中隱藏的{}。現在回頭敲我的頭對着我的清漆配置的磚牆:) – 2013-03-13 21:42:14

+0

太棒了!如果你是這個網站的新手,如果他們解決了你的問題,不要忘記接受答案!與清漆祝你好運。 – Mick 2013-03-13 22:01:46

+0

好幾年來一直在使用這個網站,但它的第一個問題:) ..已經完成了小費的感謝。 – 2013-03-13 22:08:50