solved $item.list_rank

alt=
@dim
7 years ago
167 posts
Is it possible to show the position number in the music charts in the detailed song page?
I tried to use the {$item.list_rank} but it does not work on the song page.
updated by @dim: 04/08/17 10:44:20AM
nate
@nate
7 years ago
917 posts
No that's not possible on the detail page.
michael
@michael
7 years ago
7,746 posts
The info is not there by default, but you can request it using the same system you used to get a full list of it, but then limit the list to just the item id that you're after.

Put this into your item detail page for the jrAudio module and you will get just the rank if its ranked:

        {capture assign="list_tpl"}
                {literal}
                    THE LIST RANK IS: {$_items.0.list_rank}
                {/literal}
        {/capture}
        {jrCore_list module="jrAudio" chart_field="audio_file_stream_count" chart_days="365" template=$list_tpl search1="_item_id = `$item._item_id`"}

updated by @michael: 01/05/17 12:09:19PM
michael
@michael
7 years ago
7,746 posts
Here's a different version. Doug pointed out that since there is only 1 in the list it will always be position #1, so in this version we get the top 50. If the current song is in the top 50 then its positon in that top 50 is shown.


{capture assign="list_tpl"}
{literal}
    {foreach $_items as $item}
    {if $item._item_id == $_params.my_id}
    my place in the top 50 list is: {$item.list_rank}
    {/if}
    {/foreach}
{/literal}
{/capture}
{jrCore_list module="jrSoundCloud" chart_field="soundcloud_stream_count" chart_days="365" limit=50 template=$list_tpl my_id=$item._item_id}

This one is for soundcloud songs, adjust the variables as you need them.
alt=
@dim
7 years ago
167 posts
Michael,
thanks! That`s a great solution.

Tags