Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
deleted 4 characters in body
Source Link
Ying
  • 1.4k
  • 4
  • 21
  • 37

i want to use my twig for the condition if the route is not blank then it will use home.color_scheme else it will use setting.color_scheme. Here's my code:

{% if home.color_scheme != 'default' or setting.color_scheme != 'default' %} <link href="/css/color-variations/{% route == '' ? home.color_scheme : setting.color_scheme %}.css" rel="stylesheet" type="text/css" media="screen"> {% endif %} 

but it makes some error like this:

 'Unexpected "route" tag (expecting closing tag for the "if" tag defined near line 17).' 

so what makes this error and how I can fix it?

i want to use my twig for the condition if the route is not blank then it will use home.color_scheme else it will use setting.color_scheme. Here's my code:

{% if home.color_scheme != 'default' or setting.color_scheme != 'default' %} <link href="/css/color-variations/{% route == '' ? home.color_scheme : setting.color_scheme %}.css" rel="stylesheet" type="text/css" media="screen"> {% endif %} 

but it makes some error like this:

 'Unexpected "route" tag (expecting closing tag for the "if" tag defined near line 17).' 

so what makes this error and how I can fix it?

i want to use my twig for the condition if the route is blank then it will use home.color_scheme else it will use setting.color_scheme. Here's my code:

{% if home.color_scheme != 'default' or setting.color_scheme != 'default' %} <link href="/css/color-variations/{% route == '' ? home.color_scheme : setting.color_scheme %}.css" rel="stylesheet" type="text/css" media="screen"> {% endif %} 

but it makes some error like this:

 'Unexpected "route" tag (expecting closing tag for the "if" tag defined near line 17).' 

so what makes this error and how I can fix it?

Source Link
Ying
  • 1.4k
  • 4
  • 21
  • 37

Error on ternary operation when using Twig

i want to use my twig for the condition if the route is not blank then it will use home.color_scheme else it will use setting.color_scheme. Here's my code:

{% if home.color_scheme != 'default' or setting.color_scheme != 'default' %} <link href="/css/color-variations/{% route == '' ? home.color_scheme : setting.color_scheme %}.css" rel="stylesheet" type="text/css" media="screen"> {% endif %} 

but it makes some error like this:

 'Unexpected "route" tag (expecting closing tag for the "if" tag defined near line 17).' 

so what makes this error and how I can fix it?