Hello
We have been trying to get this conditional working for a while now and I’m having no luck whatsoever. Quick background info:
We have a flash MP3 player on our article pages. It pulls the source MP3 from another entry using a relationship field (called ‘podcast_episode’). In the code below you can see it looks for the related entry then pulls in the {mp3} custom field (an ngen file upload field URL).
We changed this system recently and simply put an ngen file upload custom field called {mp3file} within the article entry page itself so we don’t have to use relationships anymore.
Now we have half of our entries using the old system and the new. Ideally we would like a conditional to display the correct information depending on whether a relationship is being used or not.
Here is the latest code I have tried but it doesn’t appear to be working. It only works if the Relationship method is being used and an entry is picked. Not if there is NO relationship entry selected and the new {mp3file} field is used instead.
{if mp3file}
{exp:lg_replace:haystack needles="player"}
{exp:lg_replace:replacement needle="player"}
[removed][removed]
<object type="application/x-shockwave-flash" data="{site_url}audio/player.swf" id="audioplayer1" height="24" width="290">
{/related_entries}
</object>
{/exp:lg_replace:replacement}
{if:else}
{exp:lg_replace:haystack needles="player"}
{exp:lg_replace:replacement needle="player"}
[removed][removed]
<object type="application/x-shockwave-flash" data="{site_url}audio/player.swf" id="audioplayer1" height="24" width="290">
{related_entries id="podcast_episode"}
{/related_entries}
</object>
{/exp:lg_replace:replacement}
{/if}ExpressionEngine 1.7.1 - Build: 20110520
Cheers
Uncommon Knowledge