简体   繁体   English

Learning Liquid - Shopify(此代码部分的问题在哪里)

[英]Learning Liquid - Shopify (where is issue on this code section)

im learning liquid language, and using visual code editor, i'm folliwing rules about writting with, but at the moment it shows me some issue on this section code, its about "Liquid syntax error (line 18): 'for' tag was never closed"我正在学习液体语言,并使用可视化代码编辑器,我正在遵循有关编写的规则,但目前它向我展示了此部分代码的一些问题,它是关于“液体语法错误(第 18 行):'for' 标记是从未关闭”

anyone is able to tell me where can i fix that?任何人都可以告诉我在哪里可以解决这个问题?

<div class="page-width">
  <div class="custom-content section-block">
    {%- liquid
   for block in section.blocks 
     case block.settings.width 
      when '25%'
        assign block_width = 'small--one-whole one-quarter' 
      when '33%'
        assign block_width = 'small--one-whole one-third'
      when '50%'
        assign block_width = 'small--one-whole one-half'
      when '66%'
        assign block_width = 'small--one-whole two-thirds' 
      when '75%'
         assign block_width = 'small--one-whole three-quarters'
       when '100%' 
         assign block_width = 'one-whole' 
    endcase -%}
    <div id="section-block-returns" class="section-block--padding grid__item {{ block_width }} {% if block.settings.alignment %}align--{{ block.settings.alignment }}{% endif %}" {{ block.shopify_attributes }}>
      <div class="grid__item-inner grid__item-inner--{{ block.type }}">
        <div class="rte">
          {{ block.settings.code }}
        </div>
      </div>
    </div>
  {% endfor %}
  </div>
</div>

You forgot to close the 'for loop' with the closing tag 'endfor', place it right after the 'endcase' closing tag.您忘记使用结束标记“endfor”关闭“for 循环”,将其放在“endcase”结束标记之后。 Like this:像这样:

{%- liquid
 for block in section.blocks 
   case block.settings.width 
    when '25%'
      assign block_width = 'small--one-whole one-quarter' 
    when '33%'
      assign block_width = 'small--one-whole one-third'
    when '50%'
      assign block_width = 'small--one-whole one-half'
    when '66%'
      assign block_width = 'small--one-whole two-thirds' 
    when '75%'
       assign block_width = 'small--one-whole three-quarters'
     when '100%' 
       assign block_width = 'one-whole' 
    endcase 
  endfor -%}

Hopefully it will work now希望它现在可以工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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