Avatar billede manse999 Nybegynder
19. juli 2006 - 08:05 Der er 2 kommentarer

rss feeds åbnes i et nyt vindue

Hej med jer.
Jeg har en lille nyhedsside på www.nyhedsoverblikket.dk
Nedenstående er koden på de forskellige sider.
Hvordan får jeg nyhederne til at åbne i et nyt vindue?
På forhånd tak.



<?php include("config.php"); ?>
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
http-equiv="content-type">
<?php echo "<title>$title - "; ?><?php echo basename(__FILE__, '.php'); ?></title>
<style type="text/css">
<?php echo "
a:link, a:visited, a:active
{
    text-decoration: none;
    font-weight: bold;
    color: $text_color
}
a:hover
{
    text-decoration: underline;
    color: $text_color
}
body {
    margin: 0px;
    font-family: Tahoma;
    font-size: 11px;
    color: $text_color;
}
p {
    font-size: 11px;
    color: $text_color;
}
#container {
    width: 750px;
    border: 1px solid $table_fill;
    border-top: 0px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}
#banner {
    background-color: $table_fill;
    color: $menu_color;
    font-size: 24px;
    font-family: Verdana;
    padding-top: 15px;
    padding-bottom: 15px;
    padding-left: 25px;
    border-bottom: 1px outset $table_fill;
    text-align: left;
}
#nav {
    background-color: $menu_color;
    padding-top: 5px;
    padding-bottom: 5px;
    text-align: left;
    border-bottom: 1px solid $table_fill;
}
#nav a {
    padding-top: 5px;
    padding-bottom: 5px;
    background-color: $menu_color;
    padding-left: 20px;
    padding-right: 20px;
    border-right: 1px solid $table_fill;
    color: $table_fill;
    text-decoration: none;
}
#nav a:hover {
    background-color: $table_fill;
    color: $menu_color;
    border-right: 1px solid $table_fill;
}
#ad {
    margin-top: 5px;
    margin-bottom: 5px;
}
#content {
    margin-left: auto;
    margin-right: auto;
    width: 750px;
    text-align: center;
    border-top: 7px solid $table_fill;
    padding-top: 3px;
    border-bottom: 7px solid $table_fill;
    padding-bottom: 3px;
    margin-bottom: 5px;
}
#content2 {
    width: 750px;
    background-color: $menu_color;
    text-align: center;
    padding-bottom: 5px;
}
#content3 {
    background-color: #fff;
    width: 740px;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 4px;
}
#content3 h1 {
    background-color: $menu_color;
    padding-top: 3px;
    padding-bottom: 3px;
    font-size: 11px;
    color: $table_fill;
    margin: 0px;
}
#content4 {
    border: 1px solid $table_fill;
    margin:0px;
    padding-left: 2px;
    text-align: left;
    padding-bottom: 2px;
}
#footer {
    width: 750px;
    background-color: $table_fill;
    padding-top: 10px;
    padding-bottom: 10px;
    color: $menu_color;
    display: block;
}
#footer a {
    color: $menu_color;
}
  </style>"; ?>
</head>
<body>
<center>
<div id="container">
<div id="banner"><?php echo "$title"; ?></div>
<div id="nav"><a href="index.php">Home</a><a href="news.php">News</a><a href="articles.php">Articles</a><a href="photos.php">Photos</a><a href="videos.php">Videos</a><a href="shop.php">Shop</a><a href="links.php">Links</a>
</div>
<div id="ad">
<?php echo "$ads"; ?></div>
<div id="content">
<div id="content2">
<div id="content3">
<h1><?php echo basename(__FILE__, '.php'); ?></h1>
<div id="content4">
<p><?php
/*
Created by Global Syndication's RSS Parser
http://www.globalsyndication.com/rss-parser
*/
set_time_limit(0);

$file = "http://search.sympatico.msn.ca/news/results.aspx?q=$keyword&format=rss&FORM=RSNR";

$rss_channel = array();
$currently_writing = "";
$main = "";
$item_counter = 0;

function startElement($parser, $name, $attrs) {
      global $rss_channel, $currently_writing, $main;
      switch($name) {
          case "RSS":
          case "RDF:RDF":
          case "ITEMS":
              $currently_writing = "";
              break;
          case "CHANNEL":
              $main = "CHANNEL";
              break;
          case "IMAGE":
              $main = "IMAGE";
              $rss_channel["IMAGE"] = array();
              break;
          case "ITEM":
              $main = "ITEMS";
              break;
          default:
              $currently_writing = $name;
              break;
      }
}

function endElement($parser, $name) {
      global $rss_channel, $currently_writing, $item_counter;
      $currently_writing = "";
      if ($name == "ITEM") {
          $item_counter++;
      }
}

function characterData($parser, $data) {
    global $rss_channel, $currently_writing, $main, $item_counter;
    if ($currently_writing != "") {
        switch($main) {
            case "CHANNEL":
                if (isset($rss_channel[$currently_writing])) {
                    $rss_channel[$currently_writing] .= $data;
                } else {
                    $rss_channel[$currently_writing] = $data;
                }
                break;
            case "IMAGE":
                if (isset($rss_channel[$main][$currently_writing])) {
                    $rss_channel[$main][$currently_writing] .= $data;
                } else {
                    $rss_channel[$main][$currently_writing] = $data;
                }
                break;
            case "ITEMS":
                if (isset($rss_channel[$main][$item_counter][$currently_writing])) {
                    $rss_channel[$main][$item_counter][$currently_writing] .= $data;
                } else {
                    $rss_channel[$main][$item_counter][$currently_writing] = $data;
                }
                break;
        }
    }
}

$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");
if (!($fp = fopen($file, "r"))) {
    die("could not open XML input");
}

while ($data = fread($fp, 4096)) {
    if (!xml_parse($xml_parser, $data, feof($fp))) {
        die(sprintf("XML error: %s at line %d",
                    xml_error_string(xml_get_error_code($xml_parser)),
                    xml_get_current_line_number($xml_parser)));
    }
}
xml_parser_free($xml_parser);


if (isset($rss_channel["ITEMS"])) {
    if (count($rss_channel["ITEMS"]) > 0) {
        for($i = 0;$i < count($rss_channel["ITEMS"]);$i++) {
            if (isset($rss_channel["ITEMS"][$i]["LINK"])) {
            print ("\n<div class=\"itemtitle\"><a href=\"" . $rss_channel["ITEMS"][$i]["LINK"] . "\">" . $rss_channel["ITEMS"][$i]["TITLE"] . "</a></div>");
            } else {
            print ("\n<div class=\"itemtitle\">" . $rss_channel["ITEMS"][$i]["TITLE"] . "</div>");
            }
            print ("<div class=\"itemdescription\">" . $rss_channel["ITEMS"][$i]["DESCRIPTION"] . "</div><br />");         }
    } else {
        print ("No News Found");
    }
}
?></p></div>
</div>
</div>
</div>
<div id="ad">
<?php echo "$ads"; ?></div>
<div id="footer"><a href="index.php">Home</a>
| <a href="news.php">News</a>
| <a href="articles.php">Articles</a>
| <a href="photos.php">Photos</a>
| <a href="videos.php">Videos</a>
| <a href="shop.php">Shop</a>
| <a href="links.php">Links</a><br>
<?php echo '&copy; ' . date('Y') . ' ' . $title; ?>  | Powered by: <a href="http://rssmini.com">
  RSSMini</a></div>
</div>
<br>
</body></center>
</html>
Avatar billede kimg Nybegynder
19. juli 2006 - 09:25 #1
Det burde gøre det ;-)

<?php include("config.php"); ?>
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
http-equiv="content-type">
<?php echo "<title>$title - "; ?><?php echo basename(__FILE__, '.php'); ?></title>
<style type="text/css">
<?php echo "
a:link, a:visited, a:active
{
    text-decoration: none;
    font-weight: bold;
    color: $text_color
}
a:hover
{
    text-decoration: underline;
    color: $text_color
}
body {
    margin: 0px;
    font-family: Tahoma;
    font-size: 11px;
    color: $text_color;
}
p {
    font-size: 11px;
    color: $text_color;
}
#container {
    width: 750px;
    border: 1px solid $table_fill;
    border-top: 0px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}
#banner {
    background-color: $table_fill;
    color: $menu_color;
    font-size: 24px;
    font-family: Verdana;
    padding-top: 15px;
    padding-bottom: 15px;
    padding-left: 25px;
    border-bottom: 1px outset $table_fill;
    text-align: left;
}
#nav {
    background-color: $menu_color;
    padding-top: 5px;
    padding-bottom: 5px;
    text-align: left;
    border-bottom: 1px solid $table_fill;
}
#nav a {
    padding-top: 5px;
    padding-bottom: 5px;
    background-color: $menu_color;
    padding-left: 20px;
    padding-right: 20px;
    border-right: 1px solid $table_fill;
    color: $table_fill;
    text-decoration: none;
}
#nav a:hover {
    background-color: $table_fill;
    color: $menu_color;
    border-right: 1px solid $table_fill;
}
#ad {
    margin-top: 5px;
    margin-bottom: 5px;
}
#content {
    margin-left: auto;
    margin-right: auto;
    width: 750px;
    text-align: center;
    border-top: 7px solid $table_fill;
    padding-top: 3px;
    border-bottom: 7px solid $table_fill;
    padding-bottom: 3px;
    margin-bottom: 5px;
}
#content2 {
    width: 750px;
    background-color: $menu_color;
    text-align: center;
    padding-bottom: 5px;
}
#content3 {
    background-color: #fff;
    width: 740px;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 4px;
}
#content3 h1 {
    background-color: $menu_color;
    padding-top: 3px;
    padding-bottom: 3px;
    font-size: 11px;
    color: $table_fill;
    margin: 0px;
}
#content4 {
    border: 1px solid $table_fill;
    margin:0px;
    padding-left: 2px;
    text-align: left;
    padding-bottom: 2px;
}
#footer {
    width: 750px;
    background-color: $table_fill;
    padding-top: 10px;
    padding-bottom: 10px;
    color: $menu_color;
    display: block;
}
#footer a {
    color: $menu_color;
}
  </style>"; ?>
</head>
<body>
<center>
<div id="container">
<div id="banner"><?php echo "$title"; ?></div>
<div id="nav"><a href="index.php">Home</a><a href="news.php">News</a><a href="articles.php">Articles</a><a href="photos.php">Photos</a><a href="videos.php">Videos</a><a href="shop.php">Shop</a><a href="links.php">Links</a>
</div>
<div id="ad">
<?php echo "$ads"; ?></div>
<div id="content">
<div id="content2">
<div id="content3">
<h1><?php echo basename(__FILE__, '.php'); ?></h1>
<div id="content4">
<p><?php
/*
Created by Global Syndication's RSS Parser
http://www.globalsyndication.com/rss-parser
*/
set_time_limit(0);

$file = "http://search.sympatico.msn.ca/news/results.aspx?q=$keyword&format=rss&FORM=RSNR";

$rss_channel = array();
$currently_writing = "";
$main = "";
$item_counter = 0;

function startElement($parser, $name, $attrs) {
      global $rss_channel, $currently_writing, $main;
      switch($name) {
          case "RSS":
          case "RDF:RDF":
          case "ITEMS":
              $currently_writing = "";
              break;
          case "CHANNEL":
              $main = "CHANNEL";
              break;
          case "IMAGE":
              $main = "IMAGE";
              $rss_channel["IMAGE"] = array();
              break;
          case "ITEM":
              $main = "ITEMS";
              break;
          default:
              $currently_writing = $name;
              break;
      }
}

function endElement($parser, $name) {
      global $rss_channel, $currently_writing, $item_counter;
      $currently_writing = "";
      if ($name == "ITEM") {
          $item_counter++;
      }
}

function characterData($parser, $data) {
    global $rss_channel, $currently_writing, $main, $item_counter;
    if ($currently_writing != "") {
        switch($main) {
            case "CHANNEL":
                if (isset($rss_channel[$currently_writing])) {
                    $rss_channel[$currently_writing] .= $data;
                } else {
                    $rss_channel[$currently_writing] = $data;
                }
                break;
            case "IMAGE":
                if (isset($rss_channel[$main][$currently_writing])) {
                    $rss_channel[$main][$currently_writing] .= $data;
                } else {
                    $rss_channel[$main][$currently_writing] = $data;
                }
                break;
            case "ITEMS":
                if (isset($rss_channel[$main][$item_counter][$currently_writing])) {
                    $rss_channel[$main][$item_counter][$currently_writing] .= $data;
                } else {
                    $rss_channel[$main][$item_counter][$currently_writing] = $data;
                }
                break;
        }
    }
}

$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");
if (!($fp = fopen($file, "r"))) {
    die("could not open XML input");
}

while ($data = fread($fp, 4096)) {
    if (!xml_parse($xml_parser, $data, feof($fp))) {
        die(sprintf("XML error: %s at line %d",
                    xml_error_string(xml_get_error_code($xml_parser)),
                    xml_get_current_line_number($xml_parser)));
    }
}
xml_parser_free($xml_parser);


if (isset($rss_channel["ITEMS"])) {
    if (count($rss_channel["ITEMS"]) > 0) {
        for($i = 0;$i < count($rss_channel["ITEMS"]);$i++) {
            if (isset($rss_channel["ITEMS"][$i]["LINK"])) {
            print ("\n<div class=\"itemtitle\"><a target=\"_blank\" href=\"" . $rss_channel["ITEMS"][$i]["LINK"] . "\">" . $rss_channel["ITEMS"][$i]["TITLE"] . "</a></div>");
            } else {
            print ("\n<div class=\"itemtitle\">" . $rss_channel["ITEMS"][$i]["TITLE"] . "</div>");
            }
            print ("<div class=\"itemdescription\">" . $rss_channel["ITEMS"][$i]["DESCRIPTION"] . "</div><br />");        }
    } else {
        print ("No News Found");
    }
}
?></p></div>
</div>
</div>
</div>
<div id="ad">
<?php echo "$ads"; ?></div>
<div id="footer"><a href="index.php">Home</a>
| <a href="news.php">News</a>
| <a href="articles.php">Articles</a>
| <a href="photos.php">Photos</a>
| <a href="videos.php">Videos</a>
| <a href="shop.php">Shop</a>
| <a href="links.php">Links</a><br>
<?php echo '&copy; ' . date('Y') . ' ' . $title; ?>  | Powered by: <a href="http://rssmini.com">
  RSSMini</a></div>
</div>
<br>
</body></center>
</html>
Avatar billede kimg Nybegynder
19. juli 2006 - 09:27 #2
Har indsat dette i din kode target=\"_blank\"

Kim
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester