[pmwiki-users] wikifarm question -- Farm:FieldName markup

John Rankin john.rankin at affinity.co.nz
Mon Aug 28 00:08:33 CDT 2006


On Monday, 28 August 2006 2:34 PM, Ben Wilson <dausha at gmail.com> wrote:
>On 28 Aug 2006 13:03:20 +1200, John Rankin <john.rankin at affinity.co.nz> wrote:
>> First, thanks to Pm for adding a $LocalDir variable.
>>
>> If we introduce a local customisation to add
>>     Farm:Field1(/GroupA(/PageB)?)? markup
>> is that likely to conflict with anything?
>
>I have a better suggestion. First, have the field be lowercase. This
>way, you can retain the CleanUrls without much of a problem. For
>example:
>
>http://www.example.org/field1/GroupA
>http://www.example.org/field2/GroupX
>
Very useful; thank you.

Where I got stuck, and which led me to propose Farm:Field/Group/Page,
is calling a local LinkIMap function to render inter-field links.
So I used Attach: markup as an example. If I use Field:Group/Page, 
how do I distinguish inter-field links from other intermap references?

Im my case, the users want the field names to be proper names,
so starting with a lower case letter is not possible, currently.
Under pmwiki 1, we use a ~ in the url to distinguish fields from
groups while keeping clean urls:

www.example.com/~Field1/Group/Page
www.example.com/Group/Page

Some of the field names are very long and camel case is a bit more
natural than all lower case. I'm not sure if I can talk them out
of it...

>Then, use Intermap markup to move between wiki fields.
>
>http://www.pmwiki.org/wiki/PmWiki/InterMap
>
I think of the Site.WikiFarm page as a special sort of intermap page.

I considered using plain intermap markup, but found 3 things I
couldn't see how to handle, in this particular case:
- because of the structure of the site, once you know it's a field,
  you can deduce the url, so it seemed unnecessary and a possible 
  source of error to specify the full url for every field; if each
  field has its own url, then yes intermap markup is the way to go

- with intermap markup, it's not obvious to me how to check whether 
  or not a page in another field exists and alter the link display
  accordingly; so I concluded I needed a special Farm: intermap
  link, which will allow me to call a custom intermap function

  and if I'm going to do that, then I may as well use a special page
  to list the fields, rather than putting them on Site.InterMap 

- only an administrator can define a new field, which means if
  somebody types www.example.com/~FieldX/Group/Page into a browser
  window, we have to check whether this is a valid field name;
  otherwise a new field will get created -- again, this seemed like
  a good reason to separate the list of fields from other intermap
  entries

I have studied your example (below) and it only gets me part of
the way, I think. Currently, the client has 18 (count 'em) fields.

> I have a site where I do this. However, as I've beem moving my local
>directories and wiki.d to non-web accessible areas, things are in a
>bit of a lurch.
>
><copied>
>Correction. I do have an example. On one of my web sites, I have an
>Interlink from the main field to a second field.[1] The link that
>points to law school (in the Law School section of that page). That
>link is an interlink. The markup looks like:
>[[Law:LawSchool.LawSchool| law school]]. On Site.InterMap, the
>Intermap link looks like:
>
>Law:http://www.dausha.net/law/
>
I could do something like:

Farm:http://www.example.com/~

but this wouldn't give a list of allowed field names, so I have to
spell them all out, ensuring that they all resolve to the same url

I then have to get an $AsSpacedFunction in so that a link to
EffectivePracticeWithELearningGuidelines:Main/HomePage gets spaced.


>That does the trick. At first blush you might have to edit the
>Site.InterMap for all fields. However, you can create a new entry for
>$WikiLibDirs that will allow you to have a common set of files shared
>amongst fields, and editable amongst fields:
>
> $WikiLibDirs = array(
>    &$WikiDir,
>    new PageStore("$FarmD/share.d/\$FullName",1), # Common, editable wiki.d
>    new PageStore("$FarmD/wikilib.d/\$FullName")
> );
>
>Then, just copy the Site.InterMap into that field. Edits to files in
>share.d are immediately available to all fields---if I'm not gravely
>mistaken.

This is very nice.
>
>Ben
>


-- 
JR
--
John Rankin







More information about the pmwiki-users mailing list