scarhand Posted July 18, 2008 Share Posted July 18, 2008 i have this code: <?php echo '<td class="' . ($page_title1 == 'Home') ? 'menutab2' : 'menutab1' . '"><a href="/"><span><span>Home</span></span></a></td>'; ?> i want it to echo "menutab#" depeding on if the $page_title1 variable is 'Home' or not. when i look at the source code, it is only echoing "menutab2", instead of "<td class="menutab2"><a href="/"><span><span>Home</span></span></a></td>" like it should im sure its simple, help? Quote Link to comment Share on other sites More sharing options...
btherl Posted July 18, 2008 Share Posted July 18, 2008 Try this: <?php echo '<td class="' . ($page_title1 == 'Home' ? 'menutab2' : 'menutab1') . '"><a href="/"><span><span>Home</span></span></a></td>'; ?> The problem was with the brackets. Quote Link to comment Share on other sites More sharing options...
scarhand Posted July 18, 2008 Author Share Posted July 18, 2008 Thanks, i ended up going this route though: <?php echo '<td class="'; echo ($page_title1 == 'Home') ? 'menutab2' : 'menutab1'; echo '"><a href="/"><span><span>Home</span></span></a></td>'; ?> Quote Link to comment 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.