Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
基本Shopify-使用settings_scheme.json中的图像_Shopify - Fatal编程技术网

基本Shopify-使用settings_scheme.json中的图像

基本Shopify-使用settings_scheme.json中的图像,shopify,Shopify,我可以在我的主题中创建一个选项来上传2张图片。这些将放在旋转木马上,作为主页的一部分 我在settings_scheme.json文件中通过以下代码实现了这一点: [ { "name": "Homepage Splash", "settings": [ { "type": "paragraph", "content": "Choose images for homepage splash" }, {

我可以在我的主题中创建一个选项来上传2张图片。这些将放在旋转木马上,作为主页的一部分

我在settings_scheme.json文件中通过以下代码实现了这一点:

[
  {
    "name": "Homepage Splash",
    "settings": [
      {
        "type": "paragraph",
        "content": "Choose images for homepage splash"
      },
      {
        "type": "image",
        "id": "slideshow_1.jpg",
        "label": "Image 1"
      },
       {
        "type": "image",
        "id": "slideshow_2.jpg",
        "label": "Image 2"
      }
    ]
  }
]
我的问题是,我现在如何访问这两个图像以将它们显示为我的“主页splash.liquid”的一部分?查看其他模板,代码应该如下所示:

{% for i in (1..2) %}
<img src='{% capture image %}slideshow_{{ i }}.jpg{% endcapture %}'>
{% endfor %}
{(1..2)%中的i的%
{%endfor%}

但这在html中没有输出任何内容。我相信这是一个非常基本的东西,我错过了,因为我是新的Shopify。请有人给我一些建议,这将真正帮助我进一步发展。谢谢,DB

您的代码应该是这样的

{% for i in (1..2) %}
    {% capture image %}slideshow_{{ i }}.jpg{% endcapture %}
    <img src="{{ image | asset_url }}"/>
{% endfor %}
{(1..2)%中的i的%
{%capture image%}幻灯片放映{{{i}}.jpg{%endcapture%}
{%endfor%}

感谢您的帮助!我正慢慢地通过Shopify实现目标