[Pmwiki-users] Re: Calendar function

John Rankin john.rankin
Sun Aug 8 17:25:18 CDT 2004


On Saturday, 7 August 2004 9:36 AM, Albi Rebmann <albi at life.de> wrote:
>> Well, this might be from outside the Calendar. I edited your Main.WikiSandbox to try:
>> 
>>   ThisPage:&action=print
>> 
>> This turns into a link that opens a new window. Do you have a
>local customisation that redefines $UrlLinkFmt (which ThisPage:
>uses) to add a "target='_blank'" so that a link to an external site opens in a new window?
>> 
>> I suspect the answer is 'yes'. 
>> 
>> Fortunately, there is a work-around, which will let you
>automatically open remote urls in a new window and local urls
>in the same window. If you really want to do this, let me know and I can send a script.
>> 
>> But first, revert to the standard pmwiki $UrlLinkFmt to
>confirm that this fixes the problem.
>
>Ah good, I have the same problem. I defined:
>$UrlLinkFmt = "<a class='urllink' target='_blank' 
>href='\$Url'>\$LinkText</a>";
>in config.php, which does this automatic for external links great. But 
>now most links in calendar opens in new window.
>
>Can you send this fix please.

Try this:

1. make a copy of scripts/thiswiki.php in local/

2. edit local/thiswiki.php and add the lines

    $EnableThisWiki = 0;
    SDV($FmtLocalUrlLink,'FmtLocalUrlLink');
    SDV($ThisUrlLinkFmt,"<a class='thisurl' href='\$Url'>\$LinkText</a>");

3. change '$FmtUrlLink' to '$FmtLocalUrlLink'

4. add the following function definition:

    function FmtLocalUrlLink($pat,$ref,$btext) {
      global $ThisUrlLinkFmt,$UrlLinkTextFmt;
      $o=$UrlLinkTextFmt;
      $UrlLinkTextFmt=$ThisUrlLinkFmt;
      $r=FmtUrlLink($pat,$ref,$betxt);
      $UrlLinkTextFmt=$o;
      return $r;
    }

5. add the following line to local/config.php

    include_once("local/thiswiki.php");

That should do it.
>
>
>ALBI...
>
>

-- 
JR
--
John Rankin





More information about the pmwiki-users mailing list