Needs PHP help!!!

Discussion in 'PHP' started by topdaytrader, Oct 24, 2007.

  1. #1
    Can anybody show me how to modify this php line to make it open in a new window:

    print ("\n<div class=\"itemtitle\"><h1><a href=\"" . $rss_channel["ITEMS"][$i]["LINK"] . "\">" . $rss_channel["ITEMS"][$i]["TITLE"] . "</a></h1></div>");
     
    topdaytrader, Oct 24, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    Add target=\"_blank\" to the <a> tag.
     
    nico_swd, Oct 24, 2007 IP
  3. WM7

    WM7 Peon

    Messages:
    778
    Likes Received:
    112
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hope OK!

    print ("\n<div class=\"itemtitle\"><h1><a href=\"" . $rss_channel["ITEMS"][$i]["LINK"] . "\" target=\"_blank\" >" . $rss_channel["ITEMS"][$i]["TITLE"] . "</a></h1></div>");
     
    WM7, Oct 24, 2007 IP
  4. topdaytrader

    topdaytrader Active Member

    Messages:
    933
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    60
    #4
    Thanks guys, it works.
    But I also want to open links in the feed description a new window, not just the title. What should I modify?

    Here's the rest of the code:
    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\"><h1><a href=\"" . $rss_channel["ITEMS"][$i]["LINK"] . "\"target=\"_blank\" >" . $rss_channel["ITEMS"][$i]["TITLE"] . "</a></h1></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>");
    }
    }
    ?>
     
    topdaytrader, Oct 24, 2007 IP
  5. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #5
    Replace:
    
    $rss_channel["ITEMS"][$i]["DESCRIPTION"]
    
    PHP:
    With:
    
    str_replace('<a ', '<a target="_blank" ', $rss_channel["ITEMS"][$i]["DESCRIPTION"])
    
    PHP:
     
    nico_swd, Oct 24, 2007 IP
  6. topdaytrader

    topdaytrader Active Member

    Messages:
    933
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    60
    #6
    Thanks for your help. Are you good with vbulletin? I just transfer my vb to a new server and its having error. I want to hire someone who's helpful as you and have experience installing vb + vb mods.
     
    topdaytrader, Oct 24, 2007 IP