Revision [14478]

This is an old revision of OpenExternalInNewWindow made by JasonHuebel on 2006-06-05 16:08:11.

 


This simple code modification will open all external links in a new window or tab, depending on your browser's configuration. This modification is useful to prevent users from navigating away from the wiki when they click an external link. External links are defined as any link that leaves the Wiki (even if they are on the same server).

Locate this line in wikka.php, somewhere around line 662:

        return $url ? "<a class=\"ext\" href=\"$url\">$text</a>$external_link_tail" : $text;


and replace it with this:

                $external_link_new_window = $this->GetConfigValue("external_link_new_window");
                if ($external_link_new_window = "0") {
                        return $url ? "<a class=\"ext\" href=\"$url\">$text</a>$external_link_tail" : $text;
                } else {
                        return $url ? "<a class=\"ext\" href=\"$url\" target=\"_new\">$text</a>$external_link_tail" : $text;
                }


Then add the following element to the wikka.config.php wakkaConfig array:

"external_link_new_window" => "1"


"0" (zero) turns off opening external links in a new window. Any non-zero value turns on opening external links in a new window.

That's all there is to it. --JasonHuebel


CategoryUserContributions
There are 4 comments on this page. [Show comments]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki