williwaw Posted February 22, 2009 Share Posted February 22, 2009 Hi all, I am trying to have the link below open in a new window when someone clicks on it. foreach ($xml->channel->item as $item) { echo "<li><a href={$item->link}>{$item->title}</a></li>"; } Thanks for the look! Cheers, williwaw Link to comment https://forums.phpfreaks.com/topic/146428-solved-target_blank-help/ Share on other sites More sharing options...
jackpf Posted February 22, 2009 Share Posted February 22, 2009 foreach ($xml->channel->item as $item) { echo "<li><a href=\"{$item->link}\" target=\"_blank\">{$item->title}</a></li>"; } How about that? Link to comment https://forums.phpfreaks.com/topic/146428-solved-target_blank-help/#findComment-768772 Share on other sites More sharing options...
williwaw Posted February 23, 2009 Author Share Posted February 23, 2009 Wow, that was fast! Thanks again for your help...it works great. One more question-same problems but the code is a little different and I can't seem to make it work. echo "<p><href={$item->description}</p>"; Sorry about being a noob, but I did not notice the difference when I originally posted this thread. Cheers, williwaw Link to comment https://forums.phpfreaks.com/topic/146428-solved-target_blank-help/#findComment-768797 Share on other sites More sharing options...
jackpf Posted February 23, 2009 Share Posted February 23, 2009 Ok, what I did was put quotes " round the url (which isnt mandatory but is strongly suggested) and then escaped them with backslashes, so that php doesn't the the quote is ending the echo. I then simply added target="_blank" escaped with backslashes aswell, so target=\"_blank\" Link to comment https://forums.phpfreaks.com/topic/146428-solved-target_blank-help/#findComment-768803 Share on other sites More sharing options...
williwaw Posted February 23, 2009 Author Share Posted February 23, 2009 Hmmmm, I did this but the target is sill the same window. echo "<p><href=\"{$item->description}\" target=\"_blank\"</p>"; Thanks for your help and the tut. Cheers, Williwaw Link to comment https://forums.phpfreaks.com/topic/146428-solved-target_blank-help/#findComment-768812 Share on other sites More sharing options...
jackpf Posted February 23, 2009 Share Posted February 23, 2009 You missed a > at the end of your a href Link to comment https://forums.phpfreaks.com/topic/146428-solved-target_blank-help/#findComment-769001 Share on other sites More sharing options...
williwaw Posted February 24, 2009 Author Share Posted February 24, 2009 Cool, thanks again for your help. Cheers, williwaw Link to comment https://forums.phpfreaks.com/topic/146428-solved-target_blank-help/#findComment-769729 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.