简体   繁体   中英

Error while printing simple value

I received this error:

Type: Twig_Error_Syntax Message: Arguments must be separated by a comma. Unexpected token "name" of value "h_open" ("punctuation" expected with value ",").

I can't show the field ticker.24h_open

       {% if ticker %}
                <div class="row">
                    <div class="col-3">
                        {{ ticker.amountAssetName }}
                    </div>
                    <div class="col-3">
                        {{ ticker.amountAssetID }}
                    </div>
                    <div class="col-3">
                        {{ ticker.amountAssetDecimals }}
                    </div>
                    <div class="col-3">
                        {{ dump( ticker.24h_open) }}
                    </div>
                </div>          
        {% endif %}

is 24 a reserved keyword in twig?

is 24 a reserved keyword in twig?

no, but an invalid variable name. Twig uses the attribute() function to access via array key.

Related Example:

{{ attribute(ticker, '24h_close') }}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM