簡體   English   中英

如何將我的文字腳本綁定到HTML文件?

[英]How do I tie my liquid script to the HTML file?

我提出了一個挑戰,我應該使用液體更改另一個HTML文件的屬性,我編寫了函數的邏輯,但是我無法將其“鏈接”到當前的html。 它與配置有關或我是否缺少某些東西? 這是我第一次使用液體或任何與紅寶石相關的代碼。

這是代碼片段:

{{% if custom_attribute.${loyalty.has_account} == false %}
{% capture destinationUrl %}https://www.thirdlove.com/account/register {% endcapture %}
{% capture buttonText %}Sing up Now{% endcapture %}
{% else %}
{% capture destinationUrl %} https://www.thirdlove.com/account/login{% endcapture %}
{% capture buttonText %}Sing in Now{% endcapture %}
{% endif %}} <a href="{{destinationUrl}}">{{buttonText}}</a>

不確定您要實現的目標,但由於Liquid是服務器端呈現的語言,因此您將無法根據用戶與HTML的交互來修改HTML。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM