Randomize this call a bit...

Dazed
Dazed
@dazed
3 years ago
1,022 posts
I have the below call which returns featured artists. What I would like to change is that when the page displays, it does not seem to ever change. I also want to randomize the songs. If I bring the page up on a different browser, I may see different artists but again, if I come back eight hours later and refresh the page, I get the same info. When I added order_by="random" on index_item_2.tpl, it caused an issue and asked me to check the config values. I also added the cached_seconds value to override system cache.

Any suggestions on how to achieve this?



                    {if strlen($_conf.MixAP_list_2_ids) > 0}
                        {jrCore_list module="jrProfile" cache_seconds="120" search1="profile_quota_id in 8,9,16,21,22,23,29"  limit="7" template="index_item_2.tpl"}
                    {else}
                        {jrCore_list module="jrProfile" cache_seconds="120" order_by="profile_jrAudio_item_count numerical_desc" limit="7" template="index_item_2.tpl"}
                    {/if}


index_item_2.tpl

{if isset($_items)}
    {jrCore_module_url module="jrAudio" assign="murl"}

    <div class="row">
    {foreach from=$_items item="item"}
        {if $item.list_rank == 1}
            <div class="col6">
                <div style="padding: 5px;">
                    <div class="featured_item">
                        <div class="cover_image">
                            {if $item.profile_header_image_size > 0}
                                <a href="{$jamroom_url}/{$item.profile_url}"  title="{jrCore_lang skin="MixAP" id="34" default="Click to view"}">
                                    {if jrCore_is_mobile_device()}
                                        {$crop = "2:1"}
                                    {else}
                                        {$crop = "4:1"}
                                    {/if}
                                    {jrCore_module_function function="jrImage_display" module="jrProfile" type="profile_header_image" item_id=$item._profile_id size="1280" class="img_scale" crop=$crop alt=$item.profile_name _v=$item.profile_header_image_time}
                                </a>
                            {else}
                                <a href="{$jamroom_url}/{$item.profile_url}"  title="{jrCore_lang skin="MixAP" id="34" default="Click to view"}">
                                    {if jrCore_is_mobile_device()}
                                        {jrCore_image image="profile_header_image.jpg" width="1140" class="img_scale" height="auto"}
                                    {else}
                                        {jrCore_image image="profile_header_image_large.jpg" width="1140" class="img_scale" height="auto"}
                                    {/if}

                                </a>
                            {/if}


                            <div class="profile_info">
                                <div class="wrap">
                                    <div class="table">
                                        <div class="table-row">
                                            <div class="table-cell profile-image">
                                                <div class="profile_image">
                                                    {jrCore_module_function
                                                    function="jrImage_display"
                                                    module="jrProfile"
                                                    type="profile_image"
                                                    item_id=$item._profile_id
                                                    size="xxlarge"
                                                    crop="auto"
                                                    class="img_scale img_shadow"
                                                    alt=$item.profile_name
                                                    width=false
                                                    height=false}
                                                </div>
                                            </div>
                                            <div class="table-cell">
                                                <div class="profile_name">
                                                    {$item.profile_name|truncate:55}<br>
                                                    <span><a href="{$jamroom_url}/{$item.profile_url}">@{$item.profile_url}</a> </span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="wrap">
                            {if $_conf.MixAP_require_price_2 == 'on'}
                                {$s1 = "audio_file_item_price > 0"}
                            {/if}
                            {if jrCore_module_is_active('jrCombinedAudio') && $_conf.MixAP_list_2_soundcloud == 'on'}
                                {jrCombinedAudio_get_active_modules assign="mods"}
                                {if strlen($mods) > 0}
                                    {jrSeamless_list modules=$mods  profile_id=$item._profile_id order_by="_created numerical_desc" limit="5" template="index_item_audio_large.tpl"}
                                {elseif jrUser_is_admin()}
                                    No active audio modules found!
                                {/if}
                            {else}
                                {jrCore_list module="jrAudio" profile_id=$item._profile_id search=$s1 order_by="audio_display_order desc" limit="5" template="index_item_audio_large.tpl"}
                            {/if}
                        </div>

                    </div>
                </div>
            </div>
        {else}
            <div class="col3">
                <div style="padding: 5px;">
                    <div class="featured_item">
                        <div class="cover_image">
                            {if $item.profile_header_image_size > 0}
                                <a href="{$jamroom_url}/{$item.profile_url}"  title="{jrCore_lang skin="MixAP" id="34" default="Click to view"}">
                                    {jrCore_module_function function="jrImage_display" module="jrProfile" type="profile_header_image" item_id=$item._profile_id size="1280" class="img_scale" crop="2:1" alt=$item.profile_name _v=$item.profile_header_image_time}
                                </a>
                            {else}
                                <a href="{$jamroom_url}/{$item.profile_url}"  title="{jrCore_lang skin="MixAP" id="34" default="Click to view"}">
                                    {jrCore_image image="profile_header_image.jpg" width="1140" class="img_scale" height="auto" crop="3:1"}
                                </a>
                            {/if}


                            <div class="profile_info">
                                <div class="wrap">
                                    <div class="table">
                                        <div class="table-row">
                                            <div class="table-cell profile-image">
                                                <div class="profile_image">
                                                    {jrCore_module_function
                                                    function="jrImage_display"
                                                    module="jrProfile"
                                                    type="profile_image"
                                                    item_id=$item._profile_id
                                                    size="xxlarge"
                                                    crop="auto"
                                                    class="img_scale img_shadow"
                                                    alt=$item.profile_name
                                                    width=false
                                                    height=false}
                                                </div>
                                            </div>
                                            <div class="table-cell">
                                                <div class="profile_name">
                                                    {$item.profile_name|truncate:55}<br>
                                                    <span><a href="{$jamroom_url}/{$item.profile_url}">@{$item.profile_url}</a> </span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>


                        </div>


                        <div class="wrap">
                            {if $_conf.MixAP_require_price_2 == 'on'}
                                {$s2 = "audio_file_item_price > 0"}
                            {/if}
                            {if jrCore_module_is_active('jrCombinedAudio') && $_conf.MixAP_list_2_soundcloud == 'on'}
                                {jrCombinedAudio_get_active_modules assign="mods"}
                                {if strlen($mods) > 0}
                                    {jrSeamless_list modules=$mods  profile_id=$item._profile_id order_by="*_display_order desc" limit="5" template="index_item_audio.tpl"}
                                {elseif jrUser_is_admin()}
                                    No active audio modules found!
                                {/if}
                            {else}
                                {jrCore_list module="jrAudio" profile_id=$item._profile_id search=$s1 order_by="audio_display_order desc" limit="5" template="index_item_audio.tpl"}
                            {/if}
                        </div>

                    </div>
                </div>
            </div>
        {/if}


        {if $item.list_rank == 3}
            </div><div class="row">
        {/if}
    {/foreach}
    </div>
{else}
    <div class="no-items">
        <h1>{jrCore_lang skin="MixAP" id="62" default="No items found"}</h1>
        {jrCore_module_url module="jrCore" assign="core_url"}
        <button class="form_button" style="display: block; margin: 2em auto;" onclick="jrCore_window_location('{$jamroom_url}/{$core_url}/skin_admin/global/skin={$_conf.jrCore_active_skin}/section=List+2')">{jrCore_lang skin="MixAP" id="64" default="Edit Configuration"}</button>
    </div>
{/if}



updated by @dazed: 06/25/21 08:30:31PM
michael
@michael
3 years ago
7,692 posts
first thing to do is to figure out which of the calls in the first part are being used, is it:
 {jrCore_list module="jrProfile" cache_seconds="120" search1="profile_quota_id in 8,9,16,21,22,23,29"  limit="7" template="index_item_2.tpl"}
or
{jrCore_list module="jrProfile" cache_seconds="120" order_by="profile_jrAudio_item_count numerical_desc" limit="7" template="index_item_2.tpl"}

if its the first one, it does not have any sort of ordering on it so will likely return the same thing every time.

if its the second one may be that profile_jrAudio_item_count does not get rebuilt multiple times a day possibly, not sure; that could be causing the issue.

What happens if you turn on developer mode (which disables caches) does it change every time then?

ACP -> MODULES -> DEVELOPER -> DEVELOPER TOOLS -> CONFIG -> Run in developer mode
Dazed
Dazed
@dazed
3 years ago
1,022 posts
Hey Michael. Thanks for the help. I removed the call on the else statement > refreshed cache and it still populated.
I also added order_by="random" and still no change. I also went to dev mode and no change.
michael
@michael
3 years ago
7,692 posts
so just start with the most basic and keep adding to it until it breaks or works:

Start with
{jrCore_list module="jrProfile" order_by="_item_id random"}
if that works then add in the profile ids
{jrCore_list module="jrProfile" order_by="_item_id random" search1="profile_quota_id in 8,9,16,21,22,23,29"}
if that works .......
updated by @michael: 03/27/21 04:10:26PM
Dazed
Dazed
@dazed
3 years ago
1,022 posts
Thanks Michael. I played with it some more and now it is changing. Thanks for the help. I did not try your order by clause yet but I will keep an eye on it and see how it works. Right now I am just happy it is updating.