[pmwiki-users] Re: newwin with defined size

Christian Schlatter ch at schlatter.net
Thu Jul 7 15:48:09 CDT 2005


> Since it's bad practice to emit PHP errors if the user mistyped the 
> markup, I suggest changing the markup so that it will be ignored until 
> it has at least one parameter, like so:
> 
>  >> Markup('newwin', 'directives', '/\\(:newwin\s+(.+?):\\)/e',
>                                               ^^^  ^
>  >>        "newwin(PSS('$1'))");
> 
> The \s+ requires a nonempty sequence of blank-space character, and the + 
> makes the regular expression want at least one character after that 
> sequence - the net result is that ParseArgs will find at least one 
> parameter and fill $args[''] with at least one array entry.

Nice solution, although I think it is still better for an end user to 
output something like "newwin error: you should define xy" instead of 
the markup itself. BTW, it would be nice to have a global PmWiki error 
handling function, that could be called within markup code. Maybe a 
function that collects all error messages (classified by markup) and 
prints them nicely at the beginning of wikitext.

> 
> Note that I strongly advise against popping up windows anyway. It's 
> annoying to people who want to open the window in a tab (instead of in a 
> new window), for example - the link to the photo would ignore the new 
> tab and open a new window anyway. It will also exclude those users who 
> have disabled Javascript for security reasons (as Yours Truly has).

Hmm, I'm also not a fan of JavaScript. On the other hand

- A standardized client-side script language is needed, and JavaScript 
seems to be the only one more or less supported by major browsers
- My own webserver statistics show that 99.8% of all visitors have 
javascript enabled
- The language itself is quite secure, only some implementations and 
some extensions (e.g. IE's JScript) are not.
- IMHO, disabling Javascript is just not the right solution. This is a 
destructive approach, since lots of useful functionality is lost. The 
same goes for restrictive firewall admins ;-)

-ChristianS




More information about the pmwiki-users mailing list