for simplistic code sake I'm trying to use ternary operators in my products.
Here's what im trying to simplify:
Code:
if ($vbulletin->options['drc_embed_vine_smpl']) {
$drc_embed_vine = '<iframe src="https://vine.co/v/$2/embed/simple" width="480" height="480" frameborder="0"></iframe>';
} else {
$drc_embed_vine = '<iframe src="https://vine.co/v/$2/embed/postcard" width="480" height="480" frameborder="0"></iframe>';
}
Now I have tried
Code:
$drc_embed_vine = '<iframe src="https://vine.co/v/$2/embed/'.(($vbulletin->options['drc_embed_vine_smpl']) ? "simple" : "postcard").'" width="480" height="480" frameborder="0"></iframe>';
Code:
$drc_embed_vine='<iframe src="https://vine.co/v/$2/embed/'.(($vbulletin->options['drc_embed_vine_smpl'])?'simple':'postcard')).' width="480" height="480" frameborder="0">';
Code:
$drc_embed_vine='<iframe src="https://vine.co/v/$2/embed/'.(($vbulletin->options[\'drc_embed_vine_smpl\'])?'simple':'postcard')).' width="480" height="480" frameborder="0">';
not one of these worked =/
although
Code:
$drc_embed_vine = '<iframe src="https://vine.co/v/$2/embed/'.(($vbulletin->options['drc_embed_vine_smpl']) ? "simple" : "postcard").'" width="480" height="480" frameborder="0"></iframe>';
does use the postcard option but it does whether the option is yes or no
btw
Code:
$vbulletin->options['drc_embed_vine_smpl']
is a simple yesno boolean
where am i going wrong =/