[pmwiki-users] Group name based $XLLangs (multilanguage Wiki)?

Oliver Betz list_ob at gmx.net
Sun May 22 09:36:02 CDT 2011


Peter Bowers wrote:

>>> Suggestion: get the language code from the URL by writing a PHP
>>> function to return the language code embedded in the page's group
>>> (the first part of the "?n=" parameter. Since that doesn't require
>>
>> since I'm using "pretty URLs", there is no ?n parameter.
>>
>> There are several possibilities of group and name encoding (dot,
>> slash, order of appearance) that I don't want to duplicate the PmWiki
>> functions if I can avoid it.
>
>My understanding of pretty URLs is that they simply change
>www.example.com/pmwiki/Group/Page to
>www.example.com/pmwiki/pmwiki.php?n=Group/Page behind the scenes.
>Thus the $_REQUEST['n'] (or $_GET['n']) is still available regardless

I don't think so if someone is using "$EnablePathInfo = 1;"

Look at mwiki.php, lines 302ff. There is also another request method,
with the "pagename" parameter instead of "n".

I don't want to duplicate this code or portions of MakePageName().

>of the use of pretty URLs.  But that's somewhat irrelevant because
>$pagename is already set to that value by the time config files are
>included...

Can I rely on pagename being set to the request when config.php is
processed?

Can I call MakePageName() early in config.php?

>Unfortunately $pagename can still be blank if the user is just looking

Correct, I missed this. But this is more a skin problem - the "Logo"
link has to be a full URL to the current default page instead of
$ScriptUrl, else the language information is lost anyway.

A link to $ScriptUrl will always start the default language.

>I would love to see either (1) a change to core to provide access to
>$pagename (validated), $name, and $group throughout config.php and
>farmconfig.php.  Or (2), at least an "officially sanctioned" way to
>access these values via PHP early on in farmconfig and/or
>config.php...

Exactly that's what I'm looking for.

> Currently a simple preg_match on $pagename will work in
>probably 99.5% (?) of situations, but it would be great to have a 100%

Looking at MakePageName(), I'm afraid it's not so simple.

Oliver




More information about the pmwiki-users mailing list