Cluster-Talk
This is the page to talk about Cluster.
Handy markup to fetch the last name of a cluster style page tile (for home pages in the format of $Group.$Group where $Group is a cluster) NB The /e modifier is deprecated
Markup('[[|-', '<[[|', "/(?>\\[\\[([^|\\]]+))\\|\\s*-(-?)\\s*]]/e", "Keep(MakeLink(\$pagename, PSS('$1'), FeralLastElement(MakePageName(\$pagename,PSS('$1') ), PSS('$2') ) ),'L')"); function FeralLastElement($what, $how=null) { global $AsSpacedFunction; global $ClusterSeparator; $pagename = ResolvePageName($what); $m = preg_split('/[.\\/]/', $pagename); $group = $m[0]; $name = $m[1]; if ( $group == $name) { $results = explode($ClusterSeparator, $name); $element = array_pop($results); } else { $element = $name; } if ( $how) { $element = $AsSpacedFunction($element); } return $element; }
This simply adds two link shortcuts as convenience items;
[[link|-]]
which displays cluster page's last element.[[link|--]]
which displays cluster page's last element as ran though$AsSpacedFunction
();
I think I found a typo in ClusterSlice() function - there's a $ClusterEnableSpaced instead of $ClusterEnableSpaces - which disables the spaced names.
Thanks! Fixed now. Kathryn Andersen June 25, 2007, at 05:24 PM
Does anyone happen to have managed to get Recent Changes pages to inherit? To stick with the usual example, I'd like Animal.RecentChanges to list all recent changes in Animal and Animal-Canine and Animal-Feline Anke December 30, 2007, at 10:59 AM
No, cluster doesn't do that. I'm not sure how to change it to do that, either.
Kathryn Andersen December 30, 2007, at 05:14 PM
$pagename = ResolvePageName($pagename); $level = ClusterCountLevels($pagename); if ($level > 1){ $Changes = array( '$g1.RecentChanges' => '*[[{$Group}.{$Name}|$Group - $Titlespaced]], $CurrentTime $[by] $AuthorLink: $ChangeSummary '); $RecentChangesFmt = array_merge($RecentChangesFmt, $Changes); } if ($level > 2){ $Changes = array( '$g1-$g2.RecentChanges' => '*[[{$Group}.{$Name}|$Group - $Titlespaced]], $CurrentTime $[by] $AuthorLink: $ChangeSummary '); $RecentChangesFmt = array_merge($RecentChangesFmt, $Changes); } if ($level > 3){ $Changes = array( '$g1-$g2-$g3.RecentChanges' => '*[[{$Group}.{$Name}|$Group - $Titlespaced]], $CurrentTime $[by] $AuthorLink: $ChangeSummary '); $RecentChangesFmt = array_merge($RecentChangesFmt, $Changes); }
Anke December 31, 2007, at 06:39 AM
There's a bug in locating GroupAttributes. Create and set attributes on:
- Kingdom/GroupAttributes
- Kingdom-Animal/GroupAttributes
Then look at:
- Kingdom/HomePage?action=attr
- Kingdom-Animal/HomePage?Action=attr
You'll see that the Kingdom-Animal/HomePage attributes are not set by Kingdom-Animal/GroupAttributes, but Kingdom/GroupAttributes.
The fix is simple. Edit cluster.php and around line 161 alter:
if (!$found_attr && PageExists("$cluster_group.GroupAttributes")) { $GroupAttributesFmt = "$cluster_group.GroupAttributes"; $found_groupfoot = true; }
to:
if (!$found_attr && PageExists("$cluster_group.GroupAttributes")) { $GroupAttributesFmt = "$cluster_group.GroupAttributes"; $found_attr = true; }
sborrill October 24, 2009, at 10:49 AM
Hi,
Is there a way to use '/' as a group separator, such that people using SEO friendly urls like Main/HomePage can use forward slash for navigating subgroups as well?
Thanks.
farhad December 17, 2009, at 10:07 AM
Hello,
New here but I've noticed a bit of a bug/regression which was seemingly fixed a while ago in the core PmWiki software.
Hard to explain without a specific example: In Group.GroupHeader put in "{$Title}". In a Group.Page with or without a (:title:) markup, the information from the Group.GroupHeader file will render as "GroupHeader" when viewing Group.Page. Now disable Cluster in the config and observe that Group.Page will now render the correct "Page" text.
I tried fiddling with various variables in config related to Cluster without obvious results. I happened on this issue while trying to create a custom group header.
(feedback)I initially tried to live without some type of hierarchy but everything I tried (about 3 days of goofing off including a display only hierarchy) was eminently unsatisfying meanwhile Cluster is just working for me (as far as organization and no headache display of said organization). For the current personal project I'm mostly taking advantage of page clustering rather than group clustering.
Thanks,
ProD? March 26, 2015, at 12:46 AM
Try using "{*$Title}" instead of "{$Title}" in the GroupHeader. Not sure about this recipe but the core PmWiki has to differenciate between the page where the variable is written and the page which is being displayed, see PageVariables#specialreferences. --Petko March 26, 2015, at 01:02 AM
Thanks, that appears to work. I also re-found the relevant bit in the documentation which states why it works (PmWiki.PageVariables#Special_references), leaving me uncertain as to why it worked without Cluster and without the asterisk.