Gossamer Forum
Quote Reply
Change Category Ordering
Q1 - Currently linksSQL shows category and subcategory names like this:

1 5
2 6
3 7
4 8

but I want to show them like this:

1 2
3 4
5 6
7 8

Q2 -and what if I want them like this also

2 1
4 3
6 5
8 7

Any suggestions....?!?!?
Thanks ahead...
Mark
Quote Reply
Re: [Mark2] Change Category Ordering In reply to
If you're talking about Links SQL 2.x, then it would require writing code to do it. For Gossamer Links 3.x, it's somewhat easy to do:

Since the order is based on the order that they're in in the category loop, you can either do the reordering in the templates (you could loop through the category list twice and only print odd categories the first time and then even ones the second time), or do that reordering in the code (write a global that uses the category loop, reorders it, and then returns a new array).

The first way would be something like this:
Code:
<%loop category_loop%>
<%~if even%><%nextloop%><%endif%>
<%~if row_num == 1%><dl><%endif%>
<%include subcategory.html%>
<%~if row_num == $category_loop.length or row_num == $category_loop.length - 1%></dl><%endif%>
<%endloop%>
<%loop category_loop%>
<%~if odd%><%nextloop%><%endif%>
<%~if row_num == 2%><dl><%endif%>
<%include subcategory.html%>
<%~if row_num == $category_loop.length or row_num == $category_loop.length - 1%></dl><%endif%>
<%endloop%>

Adrian
Quote Reply
Re: [brewt] Change Category Ordering In reply to
Thanks Adrian for all your help.
your way may work well and has flexablity, but it will require play with the source.
I found maybe a simpler way to do it by adding:
direction: rtl;
text-align: left;
into the CSS for category display and that did it..

thanks much...
Mark