[pmwiki-users] Re: newwin with defined size
Christian Schlatter
ch at schlatter.net
Mon Jul 4 16:00:34 CDT 2005
Albi Rebmann wrote:
>> A link to open a new window with defined size would look like:
>>
>> <a href="/pmwiki/Some/Page"
>> onclick="window.open(this.href, 'WindowTitle', 'width=640,height=480');
>> return false">LinkText</a>
>>
>> You could apply this pattern to e.g. $UrlLink
>
>
> Thnaks, but how can I do this exactly? I think with Markup, but do not
> know how exactly.
> I think best idea would be if I can do something like this:
> %newwin height=400 width=400%http://www.life.de
> If I add height and width, it would be a defined size for a new win.
hmm, this can surely be done with a custom WikiStyle, but I first have
to check out once how they really work ;-)
A custom markup could look like the following:
Markup('newwin', 'directives', '/\\(:newwin(.*?):\\)/e',
"newwin(PSS('$1'))");
function newwin($args) {
$defaults = array('height' => 480, 'width' => 640, 'title' => '',
'text' => '');
$args = array_merge($defaults, ParseArgs($args));
$link = array_pop($args['']);
extract($args);
$htmllink = "<a href=\"$link\" onClick=\"window.open(this.href, ".
"'$title', 'width=$width,height=$height'); return false\">".
"$text</a>";
return Keep($htmllink, 'L');
}
After copying this into config.php (or in a cookbook file), you can use
markups in a wiki page like
(:newwin http://www.life.de height=400 width=400 title="Some Title":)
-ChristianS
More information about the pmwiki-users
mailing list