DragonPrime - LoGD Resource Community
Welcome Guest
  • Good morning, Guest.
    Please log in, or register.
  • August 25, 2019, 07:38:11 AM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: [1]   Go Down
  Print  
Author Topic: external links  (Read 3469 times)
0 Members and 1 Guest are viewing this topic.
sixf00t4
Mod God
*****
Offline Offline

Posts: 1916



View Profile WWW
« on: June 24, 2004, 09:27:34 PM »

how can one add a link using addnav to have a page open in a new window, and not that small pop up window?  am i going to have to edit the addnav?  Undecided
Logged

robert
Old Dog
Mod God
*****
Offline Offline

Posts: 1047


LoGD Buff!


View Profile WWW
« Reply #1 on: June 25, 2004, 01:57:37 AM »

Not sure if this is what you're looking for:

rawoutput("<br><hr><div style=\"text-align: left;\"><a href=\"http://www.wherever.com\" target=\"_blank\">
      whatever clickable text</a><br>");

simple text link on page that will open in a new window.
Logged

sixf00t4
Mod God
*****
Offline Offline

Posts: 1916



View Profile WWW
« Reply #2 on: June 25, 2004, 02:03:27 AM »

no, i mean one that will appear in the navigation, like using the addnav() function.  I know how to do it with a pop up, but i want it to be a full window.
Logged

sixf00t4
Mod God
*****
Offline Offline

Posts: 1916



View Profile WWW
« Reply #3 on: June 25, 2004, 02:25:09 AM »

just poked around Voratus' server to see if i could figure it out, but no luck:)  I PM'ed him, hopefully he will remember what he had to do:)
Logged

anpera
Guest
« Reply #4 on: June 25, 2004, 05:07:12 AM »

The addnav() function doesn't support new windows like that, but it shouldn't be too difficult to add. You must be very careful with what pages you open in a new window then! You should add those navs to array "$allownonnav" in common.php, else the old window gives out "badnav" and returns you to the content of the new window. But if the content of the new window is a normal LoGD file like village.php, you give your players a mighty tool for cheating at hand. DO IT AT YOUR OWN RISK!
(If the nav should be used by players who are not logged in, add the filename to array "$allowanonymous", too.)

Code:
---- Open:
common.php

---- Find:
function addnav($text,$link=false,$priv=false,$pop=false){

---- Replace it with:
function addnav($text,$link=false,$priv=false,$pop=false,$newwin=false){

---- Find:
"popup"=>($pop==true ? "target='_blank' onClick=\"".popup($link.$extra)."; return false;\"" : "")

---- Replace it with:
"popup"=>($pop==true ? "target='_blank' onClick=\"".popup($link.$extra)."; return false;\"" : ($newwin==true?"target='_blank'":""))

---- If needed find and edit:
$allownonnav=array(...
$allowanonymous=array(...

A call like
addnav("Whatever","whatever.php",false,false,true);
then opens whatever.php in a new window. Note that, if the popup-switch (2nd) is set to 'true', the newwin-switch (3rd) has no effect.
Logged
Voratus
Guest
« Reply #5 on: June 25, 2004, 07:29:23 AM »

addnav("DragonDocuments.net","http://dragondocuments.net",false,true,"");

This is my link to dragondocuments.com, available in the village, which opens in a new window.
Logged
thegleek
Guest
« Reply #6 on: June 25, 2004, 07:50:12 AM »

hmm.. interesting... i had to do the same thing to add a link on my main page, so that when one of my players wished to click on it, it would take them directly to my forums or faq...

the prob i had is that trailing ?c=123456 crap didnt turn off... so i modified it as such:

Code:
---- Open:
common.php

---- Find:
function addnav($text,$link=false,$priv=false,$pop=false){

---- Replace it with:
function addnav($text,$link=false,$priv=false,$pop=false,$notrail=true){

---- Find:
if (strpos($link,"?")){ $extra="&c=$session[counter]"; } else { $extra="?c=$session[counter]"; }
$extra.="-".date("His");

---- Replace it with:
if ($notrail) {
     if (strpos($link,"?")){ $extra="&c=$session[counter]"; } else { $extra="?c=$session[counter]"; }
     $extra.="-".date("His");
}

A call like:
addnav("Basic LoGD Hints","http://www.thegleek.com/vb/showthread.php?t=3",false,false,false);
then opens your link in (the same) window without any errors from a completely different php script.

i use the above hack very often in my index.php, for example:

Code:
addnav("LoGD Forum");
addnav("www.thegleek.com","http://www.thegleek.com/vb/",false,false,false);
addnav("Thank You");
addnav("for your donation","http://www.thegleek.com/thankyou.php",false,false,false);
Logged
sixf00t4
Mod God
*****
Offline Offline

Posts: 1916



View Profile WWW
« Reply #7 on: June 29, 2004, 10:05:13 PM »

Thanks both of you!!  works great.
Logged

Pages: [1]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Welcome to DragonPrime - The LoGD Resource Community!

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
104 Guests, 0 Users
Home Forums News Downloads Login Register Advanced Search