<div class="search-result-container">
    <h2 class="rs-title nomarg">
        {#rasti#} {$realcount} {#results_w_f#}: <strong>{$phrase}</strong>
    </h2>
</div>
<br>
{assign var="show_prods" value=0}
{assign var="productlist" value=""}
{capture name="sr_page" assign="sr_page"}
    {if $itemcount > 0}
        <div class="rs-result-list">
            {foreach from=$results item=entry}
               {* <pre>
                    {$entry|@print_r}
                </pre>
                {*if $entry->module == 'Products'}
                  {assign var="show_prods" value=1}
                  {if $productlist==""}
                      {assign var="productlist" value=$entry->modulerecord}
                  {else}
                      {assign var="productlist" value="`$productlist`,`$entry->modulerecord`"}
                  {/if}
                {/if*}
                <div>
                    <h2>
                        {$entry->title}
                    </h2>
                    <div class="descr">
                        {$entry->urltxt}
                    </div>
                    <a class="url" href="{$entry->url}">{$entry->url}</a>
                </div>
                {*
                   You can also instantiate custom behaviour on a module by module basis by looking at
                   the $entry->module and $entry->modulerecord fields in $entry
                    ie: {if $entry->module == 'News'}{News action='detail' article_id=$entry->modulerecord detailpage='News'}
                *}

            {/foreach}
        </div>
    {else}
        <div>
            <strong>{$noresultsfound}</strong>
        </div>
    {/if}
    <br>
    {if $pages_array|@count > 0}
        <div class="pagination-container">
            <ul class="pagination">
                {if $prevlink}
                    <li>
                        <a href="{$prevlink}">
                            <i class="fa fa-angle-left"></i>
                        </a>
                    </li>
                {/if}

                {foreach from=$pages_array item="pag"}
                    <li {if $pag.class}class="{$pag.class}"{/if}>
                        <a href="{$pag.url}">{$pag.name}</a>
                    </li>
                {/foreach}

                {*
                <li>
                    <a href="#">1</a>
                </li>
                <li>
                    <a href="#">2</a>
                </li>
                <li>
                    <a href="#">3</a>
                </li>
                <li>
                    ...
                </li>
                <li>
                    <a href="#">23</a>
                </li>*}

                {if $nextlink}
                    <li>
                        <a href="{$nextlink}">
                            <i class="fa fa-angle-right"></i>
                        </a>
                    </li>
                {/if}
            </ul>
        </div>
    {/if}
{/capture}
{if $show_prods==1}
    {*Products detailpage=$smarty.config.detail_products productlist=$productlist*}
{else}
    {$sr_page}
{/if}
