Answer the question
In order to leave comments, you need to log in
How to correctly set the default value in the input select using foreach?
There is a quick search block as in the screenshot, it is displayed on all pages, but there was a problem, it is necessary that when the user goes to the site.ru/commercial page, then in the selecte immediately by default on this page was Commercial instead of for Sale. I'll do something like
{if $pageName == 'commercial'}select commercial{/if}, but I don't know how to select the default commercial from the list, since the list is displayed using foreach
Screenshots
prntscr.com/4cok85
prntscr.com/4cokao
www.prntscr.com/4cokdr
Answer the question
In order to leave comments, you need to log in
<option value="{$name}" {$pageName == $name ? 'selected' : ''}>{$title}</option>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question