lingo5 Posted October 19, 2011 Share Posted October 19, 2011 I can't see what I'm doing wrong here. When I use this code, the link HOME gets echoes with no problem: <td valign="middle"><?php echo '<a href="index.php"'; if(strstr($checkit,"index.php")) echo ' class="clicked"'; else echo ' class="menulinks"'; echo '>HOME</a>'; ?></td> ...but when I swap HOME with a php constant, I get nothing... <td valign="middle"><?php echo '<a href="index.php"'; if(strstr($checkit,"index.php")) echo ' class="clicked"'; else echo ' class="menulinks"'; echo '><?=CNT_TXT_HOME?></a>'; ?></td> Please help Link to comment https://forums.phpfreaks.com/topic/249392-please-help-with-constant-error/ Share on other sites More sharing options...
Pikachu2000 Posted October 19, 2011 Share Posted October 19, 2011 You have PHP tags nested within PHP tags. And you shouldn't use short tags or "quick echo" tags anyhow. Link to comment https://forums.phpfreaks.com/topic/249392-please-help-with-constant-error/#findComment-1280524 Share on other sites More sharing options...
lingo5 Posted October 19, 2011 Author Share Posted October 19, 2011 Thanks Pikachu...could you please tell me how to fix that?...I'm still lerning here. Thanks Link to comment https://forums.phpfreaks.com/topic/249392-please-help-with-constant-error/#findComment-1280525 Share on other sites More sharing options...
Pikachu2000 Posted October 19, 2011 Share Posted October 19, 2011 Get rid of the <?= and ?> before and after your constant. You're already within PHP tags at that point. Link to comment https://forums.phpfreaks.com/topic/249392-please-help-with-constant-error/#findComment-1280532 Share on other sites More sharing options...
lingo5 Posted October 19, 2011 Author Share Posted October 19, 2011 hmmm...I have tried that but all I get is "CNT_TXT_HOME" printed instead of just the value of that costant that should be "HOME..." Link to comment https://forums.phpfreaks.com/topic/249392-please-help-with-constant-error/#findComment-1280534 Share on other sites More sharing options...
Pikachu2000 Posted October 19, 2011 Share Posted October 19, 2011 Oh yeah, you need to concatenate the constant into the rest of the string. echo 'Some literal string with a ' . CONSTANT . ' in the middle.'; Link to comment https://forums.phpfreaks.com/topic/249392-please-help-with-constant-error/#findComment-1280536 Share on other sites More sharing options...
lingo5 Posted October 19, 2011 Author Share Posted October 19, 2011 aaaahhh...I see now...thanks a lot!! Link to comment https://forums.phpfreaks.com/topic/249392-please-help-with-constant-error/#findComment-1280537 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.