[pmwiki-users] Pagelist links to groups without default pages (PITS/00736)

Pico pmwiki at ben-amotz.com
Mon May 8 21:00:13 CDT 2006


Martin Fick wrote:
> --- Pico <pmwiki at ben-amotz.com> wrote:
> 
>> When it comes to pagelist directives, however, there
>> is less ambiguity
>> when creating links to groups, because we *know*
>> that {=$Group} is the
>> name of a group, not a page. 
> 
> Not really, {=$Group} is meant to mean the group, not
> the group homepage, it just happens to also be used
> that way in the group template which then causes the
> problems that you mention.

Right. That was my point.

   But, I would not suggest
> changing the semantics of what {=$Group} means since
> an author may well want to refer to a specific page
> within a group in a pagelisttemplate. i.e.
> {=$Group}.Notes
> 
> 
Right.  I never meant to suggest changing the {=$Group} page variable.
In fact, I too relied on its value to refer to the following three 
proposals for markup that could be used in PageListTemplates in place of 
a simple link to [[=$Group}]]
3. Link to the recent changes page, because its there: 
[[{=$Group}(.RecentChanges)]]
4. Link to *one* default page: [[{=$Group}(.{=$Group})]] or
[[{=$Group}(.HomePage)]]
5. Link to a search result that identifies all pages in the group:
[[{$Name}?action=search&q={=$Group}/|{=$Group}]]


> I think that there are two solutions that will give
> you  what is really wanted in the group template.  The
> first can be implemented by modifying the group
> template to have a series of (:if exists:)s such as
> (:if exists {=$Group}.HomePage:) ... so that it
> mimicks pmwiki's internal group naming resolution. 

For example, this would do the job (crude and verbose as it is):

[[#group]]
(:if expr ! equal {=$Group} {<$Group} && ! exists {=$Group}.HomePage && 
! exists {=$Group}.{=$Group}:)
* [[{=$Group}(.RecentChanges)]]
(:if expr ! equal {=$Group} {<$Group} && exists {=$Group}.HomePage:)
* [[{=$Group}(.HomePage)]]
(:if expr ! equal {=$Group} {<$Group} && exists {=$Group}.{=$Group}:)
* [[{=$Group}(.{=$Group})]]
[[#groupend]]

> Or, the second is to define another variable which
> pmwiki resolves internally that will always point to
> the proper (existing) group homepage or to nothing. 
> i.e. {=$GroupHomePage}
> 
Well, that is what I avoided suggesting.  But if another 
pagelistvariable was created (lets call it GroupLink for now) then 
GroupLink could do more than simply test for current default page names 
(Group.Group, else Group.HomePage). GroupLink could continue by 
generating the results from options #3 (Group.RecentChanges) or #5 
(search for "Group/" to generate list of pages in Group).  Since the 
purpose of GroupLink would be to provide text that would always result 
in a valid link to an existing page (or else a search), it would not 
interfere with other page variables.  The test sequence could go 
something like this:
1. Group.Group, else
2. Group.HomePage, else
3. Group.RecentChanges, else
4. (search string), where the search string would generate a linkable 
search action that: a) runs from the current page, b) queries for Group/ 
  and c) appends an alias string, i.e. | Group

While such a page variable would be an odd beast, conceptually, it would 
always return a string that could be used to create a valid and complete 
link by entering [[=$GroupLink]]

> The first one is nice since it does not require a core
> modification, but it can get out of sync with the way
> pmwiki resolves names (bad if there exists a
> Group.HomePage and a Group.Group).  The second on
> could have problems when it is blank, but I think that
> pmwiki can already handle [[]] specifically for this
> reason.  
> 
> I would personaly like the second one but hadn't
> tought of it until now. :)
> 
While its not necessary for addressing the immediate problem with 
pagelist references to groups that have no default page, it would be 
nice to have a solution that could be applied in other situations (i.e., 
sidebars)

Pico




More information about the pmwiki-users mailing list