Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Main category link listing order

Quote Reply
Main category link listing order
I've read some posts about it, but none gave me the answers i needed.

http://www.gossamer-threads.com/...n%20category;#111038

I'm using multiple categories. A lot of my links have several subcategories (provinces in my case) where they are listed. A company can be active in several provinces, but i want to flag the province where they are operating from.

So, in CatLinks i created a new field called 'main'. Further more, i've created a field in 'Links' called 'Province' (This is the province where the company is operating from). Now, can anyone help me create a global that will compare the 'Province' field with the categoryname (the subcategories are provinces) and if this is true put a 1 in the 'main' field under CatLinks and if this is false put a 0 in that field.

Now order the link listing in the province category so that the companies who operate from that province come first, then the companies who are active in that province but do not operate from that province; Main DESC.

Thanks, Dirk
Quote Reply
Re: [Dirkus] Main category link listing order In reply to
So, i've been busy working on the problem and i came up with this:

I've created a global called 'test' that leaves the province from the Full_Name. So, if Full_Name is 'Nederland/Limburg/etc..' it just leaves the Province 'Limburg'.

I've made a loop in category.html that looks like this:
<%if links%>
<%loop links_loop%>
<%if Provincie eq $test%>
<%include link.html%>
<%endif%>
<%endloop%>
<%loop links_loop%>
<%unless Provincie eq $test%>
<%include link.html%>
<%endunless%>
<%endloop%>
<%endif%>

It does the job, but it does the job per page. So it looks in page 1 and if the loop is true it puts the links on top, but when i go to page 2 it does the same thing, rather than looping all the links and if they are true put them on page 1 it takes the links on a page and loops them than the next page and the next .... I've set my build_links_per_page to 10 and i want to keep it that way.Can anyone help me with this last issue?