chrishide87 Posted February 15, 2009 Share Posted February 15, 2009 hi - i have a series of links at the bottom of my website...generated by the following code... <p class="footer_toolbar_links"> <?php foreach($menu as $item) { echo " | <a href=\"{$item->value}\">" . $item->name . "</a>"; } ?> | </p> This then creates a list of menu items at the bottom of the page... in this case those links are: " | Friends | Latest activity | Files | Pages | Blogs | Groups | Latest discussion | etc..." I want to add another link to the end of those, but to an external website (a forum) what would the php be to add this to the end? like i say this is probably very basic stuff...i've tried adding the following code: <?php echo " | <a href=\"http://www.externallink.com">External Link</a>; ?> but it didn't work...any suggestions? this is needed very urgently so any help or suggestions would be greatly appreciated.. thanks chris Quote Link to comment https://forums.phpfreaks.com/topic/145303-probably-a-realllllly-easy-question-but/ Share on other sites More sharing options...
premiso Posted February 15, 2009 Share Posted February 15, 2009 It didn't work because you are not escaping a double quote in the link: <?php echo " | <a href=\"http://www.externallink.com\">External Link</a>"; ?> Or closing the ending quote. That should work. Quote Link to comment https://forums.phpfreaks.com/topic/145303-probably-a-realllllly-easy-question-but/#findComment-762788 Share on other sites More sharing options...
allworknoplay Posted February 15, 2009 Share Posted February 15, 2009 <p class="footer_toolbar_links"> <?php foreach($menu as $item) { echo " | <a href=\"{$item->value}\">" . $item->name . "</a>"; } echo " | <a href=\"http://www.externallink.com\">External Link</a>"; ?> </p> Quote Link to comment https://forums.phpfreaks.com/topic/145303-probably-a-realllllly-easy-question-but/#findComment-762789 Share on other sites More sharing options...
bothwell Posted February 15, 2009 Share Posted February 15, 2009 You can also use single quotes as your string delimiter instead of double ones, so: <?php echo ' | <a href="http://www.externallink.com">External Link</a>'; ?> Which means you can format your HTML with the usual double quotes and you don't need to keep escaping things See string literals manual for further ref - http://uk3.php.net/types.string Quote Link to comment https://forums.phpfreaks.com/topic/145303-probably-a-realllllly-easy-question-but/#findComment-762791 Share on other sites More sharing options...
chrishide87 Posted February 15, 2009 Author Share Posted February 15, 2009 thanks guys - that worked perfectly!!! i really appreciate your help Quote Link to comment https://forums.phpfreaks.com/topic/145303-probably-a-realllllly-easy-question-but/#findComment-762793 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.