Reputation: 71
I'm trying to echo this long statement, tried looking at other answers here, nothing is fixing it.
Error:
Parse error: parse error, expecting `','' or `';''
Errors parsing -
.
<?php
$videoEmbed = get_post_meta( get_the_id(), 'ctslider_videoembedcode', true );
$postThumb = the_post_thumbnail();
echo '<div onclick="thevid=document.getElementById('thevideo'); thevid.style.display='block'; this.style.display='none'"><img src="'.echo $postThumb.'" style="cursor:pointer" /></div><div id="thevideo" style="display:none">"'.echo $videoEmbed.'"</div>';?>
Upvotes: 0
Views: 535
Reputation: 11
You have to add <?php ?>
around any php commands you are typing. try <?php echo "whatever you want here"?>
Upvotes: 0
Reputation: 22711
Can you try this,
echo '<div onclick="thevid=document.getElementById(\'thevideo\'); thevid.style.display=\'block\'; this.style.display=\'none\'">
<img src="'.$postThumb.'" style="cursor:pointer" />
</div>
<div id="thevideo" style="display:none">"'.$videoEmbed.'"</div>';
Upvotes: 0
Reputation: 2036
Do you realy need to echo a div? Can't you do that :
<div onclick="thevid=document.getElementById('thevideo'); thevid.style.display='block'; this.style.display='none'">
<img src="<?php echo $postThumb ?>" style="cursor:pointer" />
</div>
<div id="thevideo" style="display:none">
<?php echo $videoEmbed ?>
</div>
Upvotes: 0
Reputation: 407
You have to escape your ' So it gives:
echo '<div onclick="thevid=document.getElementById(\'thevideo\'); thevid.style.display=\'block\'; this.style.display=\'none\'"><img src="'.$postThumb.'" style="cursor:pointer" /></div><div id="thevideo" style="display:none">"'.$videoEmbed.'"</div>';
And you don't need echo inside the first echo
Upvotes: 6