[advanced search]
Results from the most recent live auction are here.
22 members in the live chat room. Join Chat!
Register Rules & FAQ NP$ Store Active Threads Mark Forums Read
Go Back   NamePros.Com > Design and Development > Programming
User Name
Password

Old 11-11-2006, 11:59 AM   · #1
~ The 34 Year Buzz!!
NamePros Regular
 
~ The 34 Year Buzz!!'s Avatar
 
Trader Rating: (27)
Join Date: Aug 2006
Posts: 385
NP$: 3602.00 (Donate)
~ The 34 Year Buzz!! is just really nice~ The 34 Year Buzz!! is just really nice~ The 34 Year Buzz!! is just really nice~ The 34 Year Buzz!! is just really nice
Anyone have a quick RSS answer, please??

Hi,

This is the RSS feed code, and...

PHP Code:
<?php

/*
Created by Global Syndication's RSS Parser
http://www.globalsyndication.com/rss-parser
*/

set_time_limit(0);

$file = "http://news.google.com/news?sourceid=navclient&ie=UTF-8&rls=GGLG,GGLG:2005-22,GGLG:en&q=Acne&output=rss";

$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);

// output HTML
// print ("<div class=\"channelname\">" . $rss_channel["TITLE"] . "</div>");

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=\"" . "go.php?url=" . $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 (
"<b>There are no articles in this feed.</b>");
    }
}

?>


...I'd like the links (when clicked on) to target _blank (new window) instead of _self. I'm not seeing exactly where to change it.

Thank you very much.


Please register or log-in into NamePros to hide ads
__________________
Are you happy today?
~ The 34 Year Buzz!! is offline   Reply With Quote
Old 11-11-2006, 12:12 PM   · #2
Peter
NamePros Staff
 
Peter's Avatar
 
Name: Peter
Location: Scotland
Trader Rating: (47)
Join Date: Nov 2003
Posts: 4,337
NP$: 2039.40 (Donate)
Peter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud of
Child Abuse Save The Children Save The Children
Had a quick look and it seems that you simply change the following code

PHP Code:
print ("\n<div class=\"itemtitle\"><a href=\"" . "go.php?url=" . $rss_channel["ITEMS"][$i]["LINK"] . "\">" . $rss_channel["ITEMS"][$i]["TITLE"] . "</a></div>");


too the following

PHP Code:
print ("\n<div class=\"itemtitle\"><a href=\"" . "go.php?url=" . $rss_channel["ITEMS"][$i]["LINK"] . "\" target=\"_blank\">" . $rss_channel["ITEMS"][$i]["TITLE"] . "</a></div>");
Peter is offline   Reply With Quote
Old 11-11-2006, 12:41 PM   · #3
~ The 34 Year Buzz!!
NamePros Regular
 
~ The 34 Year Buzz!!'s Avatar
 
Trader Rating: (27)
Join Date: Aug 2006
Posts: 385
NP$: 3602.00 (Donate)
~ The 34 Year Buzz!! is just really nice~ The 34 Year Buzz!! is just really nice~ The 34 Year Buzz!! is just really nice~ The 34 Year Buzz!! is just really nice
Great thanks (I gave you good rep too)

^^^^^^^^^^

Originally Posted by filth@flexiwebhost
Had a quick look and it seems that you simply change the following code

PHP Code:
print ("\n<div class=\"itemtitle\"><a href=\"" . "go.php?url=" . $rss_channel["ITEMS"][$i]["LINK"] . "\">" . $rss_channel["ITEMS"][$i]["TITLE"] . "</a></div>");


too the following

PHP Code:
print ("\n<div class=\"itemtitle\"><a href=\"" . "go.php?url=" . $rss_channel["ITEMS"][$i]["LINK"] . "\" target=\"_blank\">" . $rss_channel["ITEMS"][$i]["TITLE"] . "</a></div>");



Edit: Oops, it looks good, but doesn't work. Maybe my cache is still showing the older page even after refresh.

Thanks.
__________________
Are you happy today?

Last edited by gemini181 : 11-11-2006 at 12:47 PM.
~ The 34 Year Buzz!! is offline   Reply With Quote
Old 11-11-2006, 12:47 PM   · #4
Xyzer
Steven
 
Xyzer's Avatar
 
Name: Steven Gibbons
Location: United Kindom
Trader Rating: (45)
Join Date: Aug 2005
Posts: 1,506
NP$: 40.00 (Donate)
Xyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to all
Tsunami Relief AIDS/HIV
What I was going to say!!
Xyzer is offline   Reply With Quote
Old 11-11-2006, 12:58 PM   · #5
Dan
Buy my domains.
 
Dan's Avatar
 
Name: Dan
Trader Rating: (63)
Join Date: Feb 2006
Posts: 2,801
NP$: 54.00 (Donate)
Dan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant future
Autism Autism Autism Autism Autism Autism Autism
gemini181: try holding ctrl+refresh and shift+refresh. I forget which one it is, but it would get the page instead of your cached version if that's the problem. Try viewing the source to see if it's there.
Dan is offline   Reply With Quote
Old 11-11-2006, 01:24 PM   · #6
~ The 34 Year Buzz!!
NamePros Regular
 
~ The 34 Year Buzz!!'s Avatar
 
Trader Rating: (27)
Join Date: Aug 2006
Posts: 385
NP$: 3602.00 (Donate)
~ The 34 Year Buzz!! is just really nice~ The 34 Year Buzz!! is just really nice~ The 34 Year Buzz!! is just really nice~ The 34 Year Buzz!! is just really nice
It works now. Thanks everyone.
__________________
Are you happy today?
~ The 34 Year Buzz!! is offline   Reply With Quote
Old 11-11-2006, 01:51 PM   · #7
Xyzer
Steven
 
Xyzer's Avatar
 
Name: Steven Gibbons
Location: United Kindom
Trader Rating: (45)
Join Date: Aug 2005
Posts: 1,506
NP$: 40.00 (Donate)
Xyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to all
Tsunami Relief AIDS/HIV
Good, At least it works..
Xyzer is offline   Reply With Quote
Old 11-11-2006, 01:59 PM   · #8
Peter
NamePros Staff
 
Peter's Avatar
 
Name: Peter
Location: Scotland
Trader Rating: (47)
Join Date: Nov 2003
Posts: 4,337
NP$: 2039.40 (Donate)
Peter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud of
Child Abuse Save The Children Save The Children
cool glad to have helped.
Peter is offline   Reply With Quote
Closed Thread

NamePros is a revenue sharing forum.

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Site Sponsors
Arcade Script Website Header Design RealTechNetwork
Advertise your business at NamePros
All times are GMT -7. The time now is 11:02 AM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0