Great eyes!
You are a genius. Never would have thought of that!
So anyway, for whoever might be intrested, here is the correct version (I
also fixed some conditions):
<div style="width:100%;text-align:center;"><(search group={parents}.+
when='gamedate {+p}' template=datespaging count=false join=false)></div>
/*[[#datespaging]]
[(template first)][if ! equal {+p} {p}][[{+p}|+]] -[if]
[(template each)][if equal {+p} {p}][if more {+count} 2][if more {+count}
3] ... -[if] [[{+prev}|+]] -[if] {+title} [if less {+count} { {+matches}-1
}]- [[{+next}|+]] [if less {+count} { {+matches}-2 }]- ... [if][if][if]
[(template last)][if ! equal {+p} {p}]- [[{+p}|+]][if]
[[#enddatespaging]]*/
Thanks again A LOT.
Cheers,
Tiffany/Maelite
Le mercredi 4 novembre 2015 14:23:49 UTC+1, Dan a écrit :
>
> When I first tried this, my code worked fine. Couldn't figure out what you
> were saying, until I noticed you have spaces in your math expression.
>
> So { {+matches} - 2 } needs to be { {+matches}-2 }
>
> Otherwise the - and 2 are ignored (considered separate parameters), and it
> returns the value of matches. In this case quote marks don't work as it
> breaks the pattern match. You would think quotes would work in the math
> function, but after testing, I realized the expression filter (in
> variables.php) does not allow spaces.
>
> I'm sure we could figure out how to modify that--and I'd be open to adding
> it to the code. Another solution might be to strip all spaces out in the
> math function before doing the filter. But both solutions only solve the
> problem in the math function, and leave the math expression working
> differently. To keep them consistent, we would have to change the pattern
> in the math expression markup to allow quote marks and spaces. But maybe
> it's best to simply keep it clean and tight. No spaces in math expressions.
>
> Cheers,
> Dan
>
>
> On Tue, Nov 3, 2015 at 1:00 AM Tiffany Grenier <[email protected]
> <javascript:>> wrote:
>
>> Hi,
>> I'm trying to have a series of links in the style of a paging bar, but I
>> have the impression that we cannot do maths on template variables.
>>
>> Usually, I want "first - ... - previous - current - next - ... - last",
>> but I also want to avoid repeating pages and I want to avoid using "..."
>> between adjacent pages.
>>
>> From the results I get, I would say that [if less {+count} { {+matches}
>> - 2 }] does as if it were [if less {+count} {+matches}]. I also tried using
>> [if less {+count} {(math "{+matches} - 2" )}] but this gets apparently
>> always evaluated to false.
>> Thus, when the current page is the beforelast one the output contains an
>> unwanted "- ... " before the link to the last item, and when the current
>> page is the antepenultimate one, the output has an unwanted "- last - ... "
>> also before the link to the last item.
>>
>> My code is the following:
>> <div style="width:100%;text-align:center;"><(search group={parents}.+
>> when='gamedate {+p}' template=siblingspaging count=false join=false)>
>> </div>
>> /*[[#siblingspaging]]
>> [(template first)][if ! equal {+p} {p} && ! equal {+next} {p}][[{+p}|+]]
>> -[if]
>> [(template each)][if equal {+p} {p}][if more {+count} 2][if more {+count}
>> 3] ... -[if] [[{+prev}|+]] -[if] [[{+p}|+]] [if less {+count} { {+matches}
>> - 2 }]- [[{+next}|+]] [if less {+count} { {+matches} - 3 }]- ...
>> [if][if][if]
>> [(template last)][if ! equal {+p} {p} && ! equal {+prev} {p}]-
>> [[{+p}|+]][if]
>> [[#endsiblingspaging]]*/
>>
>>
>> Anyone knows how I what I should change to get the desired result?
>>
>> Cheers and thank you in advance for any help,
>> Tiffany/Maelite
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "BoltWire" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected]
>> <javascript:>.
>> Visit this group at http://groups.google.com/group/boltwire.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
--
You received this message because you are subscribed to the Google Groups
"BoltWire" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/boltwire.
For more options, visit https://groups.google.com/d/optout.