Is there php function i can implement in my website that all links that are clicked are opened in new window.... thank you
You can do it with the "<a>" command. <a target="_blank" href="link">Title</a> Code (markup): The {target="_blank"} is the important bit. It makes the link open in a new window. You also have _parent, _self and _top but never used them so don't know exactly what they do.
I knew that, but thank you anyway..... I am looking for php function or javascript example of this. If there is a chance that new link openes no matter which link you click
to be exact i need links from rss feeds to open in new window I want to keep visitors on my site also
If you used a function, you would have to tell the link to visit the function. There is a way, I think it was using CSS Can't remember tho BRAINWAVE Build a little script that grabs the feed, and do a str_replace Replcae <a href with <a target='_blank' href Worth a try.
Here is the code ... how can i implement links from feeds to open in new window ? <? /* crispy_RSS® http://jamesr.net/rss ----------------------------------------------------- Compiled by James Roberts (http://jamesr.net/) Stolen from various sources on and around the web. * Modified for use with Movable Type and LiveJournal generated RSS feeds. */ error_reporting(0); function startElement($parser, $tagName, $attrs) { global $insideitem, $tag; if ($insideitem) { $tag = $tagName; } elseif (($tagName == "ITEM") || ($tagName == "IMAGE")) { $insideitem = true; } } function endElement($parser, $tagName) { global $insideitem, $tag, $title, $description, $link, $iurl, $i, $n; if ($i >= $n) { return; } // Display Image elements [Edit markup below to customise output] if ($tagName == "IMAGE") { printf("<div class=\"rss_img\"><a href='%s'>", trim($link)); printf("<img src='%s' border='0' />", $iurl); printf("</a></div>"); $title = ""; $description = ""; $link = ""; $iurl = ""; $insideitem = false; } // Display text CDATA [Edit markup below to customise output] if ($tagName == "ITEM") { printf("<div class=\"rss_title\"><a href=\"$link\">"); printf(htmlspecialchars(trim($title))); printf("</a></div>\n"); printf("<div class=\"rss_desc\">"); if (strlen ($description) > 0) { printf(trim($description)); } printf("</div>\n"); $title = ""; $description = ""; $link = ""; $iurl = ""; $insideitem = false; $i += 1; } } function characterData($parser, $data) { global $insideitem, $tag, $title, $description, $link, $iurl; if ($insideitem) { switch ($tag) { case "TITLE": $title .= $data; break; case "DESCRIPTION": $description .= $data; break; case "LINK": $link .= $data; break; case "URL": $iurl .= $data; break; } } } function parse_feed ($url, $num) { global $insideitem, $tag, $title, $description, $link, $iurl, $i, $n; $insideitem = false; $tag = ""; $title = ""; $description = ""; $link = ""; $iurl = ""; $i = 0; $n = $num; // Prepare and create the expat parser. $xml_parser = xml_parser_create(); xml_set_element_handler($xml_parser, "startElement", "endElement"); xml_set_character_data_handler($xml_parser, "characterData"); $fp = fopen($url,"r") or die("Error reading RSS data."); while ($data = fread($fp, 4096)) { xml_parse($xml_parser, $data, feof($fp)) or die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); } fclose($fp); xml_parser_free($xml_parser); $i = 0; } ?>