This works fine:
{exp:channel:entries channel="mychannel" limit="1" url_title="{segment_3}"}
$.dpSocialBar(
{
items: {
twitter: { url: '{twittermember}', text: '{title} on twitter' },
},
});
{/exp:channel:entries}ie the channel fields twittermember and title are made available to the javascript. If I include a conditional to test for the field it breaks
{exp:channel:entries channel="mychannel" limit="1" url_title="{segment_3}"}
$.dpSocialBar(
{
items: {
{if twittermember !=""}
twitter: { url: '{twittermember}', text: '{title} on twitter' },
{/if}
},
});
{/exp:channel:entries}
I’ve just noticed this post, http://ellislab.com/forums/viewthread/200960/ . John says you cannot use ee conditionals within javascript in which case how can I test for the existence of the ee field?