shopify - 使用 Liquid 将下拉框中的项目大写
问题描述
第一次使用 Liquid.. 我是一个老式的 Vbasic 程序员。我为我们的 Shopify 商店添加了一些自定义功能。我已经制定了代码机制的基本细节并使其正常工作,但我希望在创建保管箱时将项目正确大写。
{% if section.settings.show_collection_tags and section.settings.collection_tags == 'dropdown' %}
{% if collection.url.size == 0 %}
{% assign collection_url = routes.all_products_collection_url %}
{% else %}
{% assign collection_url = collection.url %}
{% endif %}
{% assign has_tags = false %}
{% capture tags_html %}
<span class="tags filter">
<label for="filter-by">{{ 'collections.general.filter_by' | t }}:</label>
<select id="filter-by" class="redirect">
<option value="{{ collection_url }}">{{ 'collections.general.all_items' | t }}</option>
{% for tag in collection.all_tags %}
{% unless BadTags contains tag %}
<option value="{{ collection_url }}/{{ tag | handle }}" {% if current_tags contains tag %}selected="selected"{% endif %}>{{ tag }}</option>
{% assign has_tags = true %}
{% endunless %}
{% endfor %}
</select>
</span>
{% endcapture %}{% if has_tags %}{{ tags_html }}{% endif %}
{% endif %}
我尝试使用| Capitalize
以下{{{ tag | handle
,但没有奏效。
我哪里错了?
解决方案
推荐阅读
- drools - 在 Drools 中调试 when 子句的可能方法是什么?
- javascript - 如何仅渲染子子项而不渲染所有高级组件
- python - 逻辑表达式:为什么“str1 in str2 or str2 not in str1”为我的打印语句返回 True?
- blockchain - 将以太坊或比特币地址转换为 Polkadot 或基于 Substrate 的地址
- swift - 在 Firebase 中使用电话号码注册用户是否需要任何权限?
- javascript - 使用 js/jQuery 验证字段
- python - 你好。我正在尝试制作一个笔记页面,但我遇到了一个问题。Url-for 没有提供所需的功能
- html - 将 2 个段落彼此相邻对齐
- apache-kafka - 反应程序在将所有消息发送到 Kafka 之前提前退出
- linux - 系统编程 - i/o asysnhronous 机制之间的区别