[pmwiki-users] How to support case in-sensitive Wiki page names
Crisp, Steve [UK]
SCRISP at ngms.eu.com
Mon May 15 06:10:42 CDT 2006
> On 15 May 2006 01:36 John Rankin [mailto:john.rankin at affinity.co.nz]
> wrote:
> Depending on your file naming convention, a local customisation
> might be possible. It won't make pagenames case-insensitive, but
> it should make your pages more "findable".
>
> If your converted pages are all of the form Group.Pagename -- ie
> the first letter of the name is capitalised, but other letters are
> lower case, I think it can be done via a local $MakePageNameFunction
> without changing pmwiki itself.
>
> You need to make a local copy of function MakePageName and add
> an extra test that checks to see whether a page exists with the
> first letter capitalised and others all lower case. This will
> cause (for example) [[TestFile]] to refer to Group.TestFile if
> it exists, but if not it will find Group.Testfile, if it exists.
>
> Something like this: change the last line of the function
>
> return "$group.$name";
>
> This becomes:
>
> $altname = $name[0] . strtolower(substr($name, 1));
> return (PageExists("$group.$altname")) ?
> "$group.$altname" : "$group.$name";
>
> Then your config.php needs to add the line
>
> $MakePageNameFunction = 'AltMakePageName';
> (assuming you called the local function AltMakePageName)
>
> Hope this helps
> John
Hope this helps? Thank you John, this helps a lot - more 'findable' is
what I was after especially as most offending page names are
Group.Pagenameinlowercase.
I have implemented this and it works great however, I had to do one
other change to the new function. I had to comment out the following
line:
if (@$MakePageNameFunction)
return $MakePageNameFunction($basepage,$x);
... otherwise I got a 'content-length: 0' at the browser. I think it
was an infinite recursion. Have I done this correctly?
So for completeness and a single point of reference, this is what makes
PmWiki pages more 'findable':
1. Copy the attached altmakepagename.php file to your cookbook dir
2. Add the following to your local/config.php:
include_once('cookbook/altmakepagename.php');
$MakePageNameFunction = 'AltMakePageName';
3. Check permissions on your new file et. al.
Thanks again for your help John, couldn't have done this without you.
-Steve.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: altmakepagename.php
Type: application/octet-stream
Size: 1824 bytes
Desc: altmakepagename.php
Url : /pipermail/pmwiki-users/attachments/20060515/babc41ba/attachment.obj
More information about the pmwiki-users
mailing list