solved Replace "jrCore_media_player: no media found for player"

alt=
@andrusito
10 years ago
302 posts
Hello and good morning :)

How can I replace the message appearing when there's no audio file on an artist page? I'd like to show something like:

"This artist has not uploaded any song yet. Come back later if you want"

thanks.
updated by @andrusito: 06/01/14 07:57:12PM
michael
@michael
10 years ago
7,714 posts
That looks like a system level error. What code are you using to get that error because it feels like your template code could be wrong.
alt=
@andrusito
10 years ago
302 posts
I'm using this code:

{jrCore_media_player type="jrAudio_player_dark" module="jrAudio" field="audio_file" search="_profile_id = `$_profile_id`" order_by="audio_display_order numerical_asc" limit=100 autoplay=false}

Here u have examples:

No music files
http://devocionmusical.com/7d-agentez-de-paz

With music files
http://devocionmusical.com/carina-valerga

Thanks
douglas
@douglas
10 years ago
2,790 posts
You could try adding an if statement to check for the audio file size, I'm not sure how well it will work on the audio list page though.

{if isset($item.audio_file_size) && $item.audio_file_size > 0}
    Player code goes here...
{/if}

Hope this helps,
Douglas


--

Douglas Hackney
Jamroom Team - Designer/Developer/Support
FAQ-Docs-Help Videos
alt=
@andrusito
10 years ago
302 posts
I added it, but it did not show the player even when the artist had songs..
douglas
@douglas
10 years ago
2,790 posts
I'm not sure that is going to work on the audio list page, since there can be more than one song listed.

Do you get any errors when using it?


--

Douglas Hackney
Jamroom Team - Designer/Developer/Support
FAQ-Docs-Help Videos
michael
@michael
10 years ago
7,714 posts
The issue seams like your allowing profiles to upload a song to their profile, then passing in the profile_id as the key to the song.

The problem is that there is no way of knowing if they have or not because the song details are not available in the template where your requesting the player.

The only thing I can think of is to output it to assign="some_var" then see what gets output. then check that string exists or not:

{jrCore_media_player type="jrAudio_player_dark" module="jrAudio" field="audio_file" search="_profile_id = `$_profile_id`" order_by="audio_display_order numerical_asc" limit=100 autoplay=false assign="some_var"}

{if $some_var|strstr:"no media found for player"}
 Hey there, sorry, we didnt find any songs for this guy.
{else}
  {$some_var}
{/if}
alt=
@andrusito
10 years ago
302 posts
@michael, you rock!

That worked very fine :) Thanks!

Tags