16
HTML & templates / Change ?rev
« on: December 09, 2007, 01:24:41 PM »
Can we change ?rev to a urlvar that needs a value because I am trying to create a sort button that will automatically reverse the list each time it is pressed but it is impossible with the way that the if macro says something is true, the ?rev urlvar is always empty when called by {{urlvar|rev}} and therefor always false.
I tried assigning a value to ?rev but then the list wasnt reversed.
a couple different of if macros I tried are.
{{if | {{match | {{urlvar | sort}} | n}} | {{if | {{match | {{urlvar | rev}} | 1}} | ?rev&sort=n | ?rev=1&sort=n}} | ?rev=1&sort=n}}
and
{{if | {{urlvar | sort}} | {{if | {{urlvar | rev}} | ?sort=n | ?rev&sort=n}} | ?sort=n}}
I think that the second one is the simpler and more lightweight of the two and the only thing that is stopping it from working is that ?rev is always reported as empty creating a false statement when it is true.
Note: I just did a test before I post and I found that when the urlvar is empty (ie ?test) and you try to match it with something, it returns true. Which explains why my first if macro doesn't work.
Note: I have something that works with the current problems im facing but needs a little of refining still.
<a href="{{if | {{urlvar | sort}} | {{if | {{match | {{urlvar | sort}} | n}} | {{if | {{urlvar | rev}} | ?rev&sort=n | ?rev=1&sort=n}} | ?rev=1&sort=n}} | ?rev=1&sort=n}}">Name</a>
I tried assigning a value to ?rev but then the list wasnt reversed.
a couple different of if macros I tried are.
{{if | {{match | {{urlvar | sort}} | n}} | {{if | {{match | {{urlvar | rev}} | 1}} | ?rev&sort=n | ?rev=1&sort=n}} | ?rev=1&sort=n}}
and
{{if | {{urlvar | sort}} | {{if | {{urlvar | rev}} | ?sort=n | ?rev&sort=n}} | ?sort=n}}
I think that the second one is the simpler and more lightweight of the two and the only thing that is stopping it from working is that ?rev is always reported as empty creating a false statement when it is true.
Note: I just did a test before I post and I found that when the urlvar is empty (ie ?test) and you try to match it with something, it returns true. Which explains why my first if macro doesn't work.
Note: I have something that works with the current problems im facing but needs a little of refining still.
<a href="{{if | {{urlvar | sort}} | {{if | {{match | {{urlvar | sort}} | n}} | {{if | {{urlvar | rev}} | ?rev&sort=n | ?rev=1&sort=n}} | ?rev=1&sort=n}} | ?rev=1&sort=n}}">Name</a>