1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

A little help escaping chars.

Discussion in 'PHP' started by dakar, Sep 24, 2005.

  1. #1
    Hey all, got what should be a particularly simple question for anyone that has a clue (obviously I don't).

    Got this line of code that pulls a list of URL's from the database for display, just lists the referring sites from where a visitor came from for my forums. However I'm trying to figure out how to add a rel="nofollow" to each URL (trying to avoid any potential outbound links to a bad nieghborhood even if I was found through one).

    
    'URL' => '<a href="' . $row['referrer_url'] .'">' . $url_name . '</a>', 
    
    Code (markup):
    I'm just not sure of what characters of the rel="nofollow" need to be escaped and how without breaking the script.

    TIA
     
    dakar, Sep 24, 2005 IP
  2. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,333
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #2
    'URL' => '<a href="' . $row['referrer_url'] .'" rel="nofollow">' . $url_name . '</a>', 
    PHP:
     
    digitalpoint, Sep 24, 2005 IP
  3. dakar

    dakar Active Member

    Messages:
    203
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    83
    #3
    Awesome, thanks Shawn! Works perfectly. I'm learning, slowly but surely.
     
    dakar, Sep 24, 2005 IP