I have a PHP if/else statement. This is the code I’m trying to echo under an else condition.
<?php $locked = ForumData::is_topic_locked($post->topic_id);
if ($locked->topic_locked == 1) {echo '<td align="right"><font color="#FF0000">Topic Locked</font><td>';}
else {
echo '<td align="left"><a href="'.url('Forum/create_new_post?topic_id='.$post->topic_id.'&forum_id='.$post->forum_id.'').'"><img src="<?php echo SITE_URL?>/lib/skins/flyeuro/images/forums/t_reply.gif"/></a></td>'; }
?>
The bit I’m interested to echo is this.
<img src="<?php echo SITE_URL?>
If I try this… ‘echo SITE_URL’
Parse error: syntax error, unexpected T_ECHO, expecting ',' or ';'
But this doesn’t parse the image, and if I try parsing anything else, it’s giving me parsing errors, which I can’t fix?
How can I therefore produce an echo inside another echo?
why did you open a
<?phptag again, you are already in echo line?and what is
SITE_URL? Is that a variable, did you forget to put$?echo prints out the string that you gave as parameter,
As @hakre mentioned about it,
.is used to concatenate strings.So you can use it in echo line,
And It’s not important weather variable defined as a string. It would be a constant variable.