2

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?

1 Answer 1

2

Try this:

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

you suppose to use {{ instead of {%.

Sign up to request clarification or add additional context in comments.

2 Comments

it work, but i see no output. it suppose have an output like yellow.css or red.css why i just see it ".css" only?
ah ok, i found the problem already, i direct it on the wrong controller. thanks.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.