Clan Adverts

Open in New Window and Add Nofollow to External Links in Phpnuke News Articles

Description: This hack will open links in a new window and add nofollow to any external link posted in Phpnuke articles on your website.
Version: 1.0
Added on: 06 June 2009
Author: Floppy
Difficulty Level: Very Easy
Views: 3678
Detailed Profile

Open your current theme.php and find function themearticle. Below is an example, but yours may not look exactly like it.

Find

Code:
function themearticle ($aid, $informant, $datetime, $title, $thetext, $topic, $topicname, $topicimage, $topictext, $notes, $related) {  //montego - added $notes for RavenNuke
   global $admin, $sid, $tipath, $db, $prefix;


On a new line below add
Code:
   //Floppy's Nofollow External and New Window Links for Phpnuke News Hack (www.clanthemes.com)
   $your_domain = 'clanthemes.com';//Change this to your domain
   preg_match_all('#href="((http://www.|http://|www.)(.*?))"#',$thetext,$matches);
   foreach($matches[0] as $link){
      if(stristr($link, $your_domain) == false){
         $thetext = str_replace($link, $link.' rel="nofollow" target="_blank"', $thetext);
      }
   }