[pmwiki-devel] Cluster & skin integration

Hans design5 at softflow.co.uk
Sun Mar 18 05:32:26 CDT 2007


Sunday, March 18, 2007, 9:57:49 AM, Kathryn wrote:

> I'm not sure how, I'd have to look at the code.
> It might be possible to generalize the function so you passed
> in the name of the page you were looking for.

perhaps as simple as this (untested):

function ClusterPageName($group, $name) {
  global $ClusterSeparator;
  global $SiteGroup;
  $groups = explode($ClusterSeparator, $group);
  while (count($groups) != 0) {
    $cluster_group = implode ($ClusterSeparator, $groups);
    if (PageExists("$cluster_group.$name")) {
      // short-circuit return!
      return "$cluster_group.$name";
    }
    array_pop($groups);
  }
  return "$SiteGroup.$name";
}

$FmtPV['$ClusterSomePage'] = 'ClusterPageName($group, "SomePage")';


Hans




More information about the pmwiki-devel mailing list