[pmwiki-users] Hg tweaks...

The Editor editor at fast.st
Thu Feb 1 14:58:01 CST 2007


On 2/1/07, Kathryn Andersen <kat_lists at katspace.homelinux.org> wrote:
> On Thu, Feb 01, 2007 at 08:33:04AM -0500, The Editor wrote:
> > Just add subname vars to Hg for various uses (esp in ZAP)...
> >
> > {$n1}, {$n2}, etc.  {$n0} gives the count...
>
> Good!
>
> Are you going to include the relative '^' link markup?

Yes, actually it's already in!

> > Didn't document it, but the separator can be changed from a hyphen to
> > whatever you want by setting $hgseparator to some other value before
> > calling hg.php
>
> Noted.
>
> > Hope more of you will give this a try.  It is proving to be a very
> > useful little script.  It makes quite a few really neat things
> > possible...
>
> I've given it a go; if it works I'll be able to change my stuff that's
> split into a farm so that it's back as one wiki, which will be great!

It seems to be working great for me.  Hope so for you as well, if not
we'll fix it.

> One problem I found was that it wouldn't work at first because it was
> complaining that the function "bcadd" didn't exist.  This is because my
> version of PHP was compiled without support for the bcmath library.
>
> So I changed this line:
>
>  $hg = "g" . bcadd($g,1);
>
> to
>
>  $hg = "g" . ($g + 1);
>
> And that seemed to work.
>
> Any particular reason why you used bcadd rather than the simple "+"?

I'll make the change.  I've had problems with the simple notation in
certain situations in the past but if it works fine here, great.
Didn't realize some php installations didn't include this.

> > PS.  Still looking for help with a way to create a pagelist that will
> > return exactly one name for each instance of a subgroup--perhaps by
> > creating some kind of custom search routine.  Can anyone suggest a way
> > to do it?
>
> Well, you could make a $SearchPatterns pattern for subgroup pages...
>
> $SearchPatterns['subgroup']['group'] = '/^[^-]*-[^-]*-/';
>
> > Specifically, if I have pages:
> >
> > Main-One.A
> > Main-One.B
> > Main-Two.A
> > Main-Two.B

Well it would be easy enough to do group=Main-*

> > I'd like to be able to get exactly one instance of One and Two.  A
> > basename pattern?
>
> Wouldn't it work to then have a pagelist template which checks the value
> of $g2?
>
> (:if !equal "{<$g2}" "{=$g2}":)
> {=$g2}
> (:ifend:)
>
> I haven't tried it, but hopefully it would work.

I don't know that the subgroup variables would be created for each
item in the page list--as they are only created when Hg is run.  Or
are you saying there's a way to do something when a page is a new
group... That would do it exactly...  Yes, there must be as some
pagelists return nothing but a list of groups.  Perfect!  Thanks
Kathryn--that's the answer!

Cheers,
Dan



More information about the pmwiki-users mailing list