V
V
viktorross2019-05-05 05:04:44
Smarty
viktorross, 2019-05-05 05:04:44

Output in select?

Hello, tell me please, is it possible to display such a link in select2?

{if isset($categories_array) && $categories_array|@count}

{if !$seo_settings.enable_mod_rewrite}{if $constructed_url|strchr:"?"}{assign var="separator" value="&"}{else}{assign var="separator" value="?"}{/if}{/if}

{foreach from=$categories_array item=v name="categories_list"}
<div class="property">

<a href="{if $seo_settings.enable_mod_rewrite}{seo->makeSearchCategoryLink p1=$v.id p2=$v.name}{else}{$constructed_url}{$separator}category={$v.id}{/if}" class="sdjbfkj_JKJ_j">#{$v.name}</a>

</div>
{if $categories_array|@count>10 && $smarty.foreach.categories_list.index==9}
<div id="more_categories_link"><a id="more_categories" class="more_link sdjbfkj_JKJ_j" href="javascript:;">{$lng.search.more}</a></div>
<div style="display: none;" id="more_categories_list">
{/if}
{/foreach}

Tried like this, but outputs each row in a separate select
<div class="property">
{literal}
<link href="https://site.ru/select/dist/css/select2.min.css" rel="stylesheet" />
<script src="https://site.ru/select/dist/js/select2.min.js"></script>
<script>
$(document).ready(function() {
    $('.tests45').select2();
});
    </script>
{/literal}

<select class="tests45">
  <option value="{if $seo_settings.enable_mod_rewrite}{seo->makeSearchCategoryLink p1=$v.id p2=$v.name}{else}{$constructed_url}{$separator}category={$v.id}{/if}" >{$v.name}</option>
</select>

What to do in such a situation?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question