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 Quote 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. Quote 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 Quote 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. Quote 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..." Quote 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.'; Quote 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!! Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.