[pmwiki-devel] Cluster & skin integration
The Editor
editor at fast.st
Sun Mar 18 07:03:06 CDT 2007
On 3/18/07, Hans <design5 at softflow.co.uk> wrote:
> 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")';
Just implemented this capability in Hg--and released the upgrade.
Works beautifully Hans. Thanks again--you are on a roll!
While on the subject of breadcrumbs, let me explain why Hg doesn't
have a breadcrumb markup.
Bascially, if you are doing anything remotely interesting on a site
with Hg/Cluster (like I did with the PmWiki forum site) you really
don't want to use the breadcrumb markup. For example, I set all my
comments in various child pages of Comments, and all my Forum posts in
child pages of Questions. So it takes one form in one groupfooter a
piece to manage all the comments and questions you could want. You
can even have sub-sub topics and it all works the same.
However I did not want the breadcrumbs to look like the directory
structure--I want it to look more intuitive to what the viewer is
thinking. So I used a Site.Breadcrumb page with a bunch of
conditioals to really rework the breadcrumb in various ways to get the
effect I need. But with a hierarchical $BreadCrumb variable like this
new upgrade allows, it takes all the fun out of it. It's now a piece
of cake!
Oh well. I guess I'll go ahead and throw it in to hg anyway. Some
might like it, and it is pretty easy to do... What, about 5 lines?
Just a minute...
Cheers,
Dan
More information about the pmwiki-devel
mailing list